Changeset - d305cd8c13d7
[Not reviewed]
0 1 0
Christopher Neugebauer - 8 years ago 2016-06-18 07:07:21
chrisjrn@gmail.com
Requires comments for non-abstain votes only
1 file changed with 14 insertions and 1 deletions:
0 comments (0 inline, 0 general)
symposion/reviews/models.py
Show inline comments
...
 
@@ -5,2 +5,4 @@ from decimal import Decimal
 

	
 
from django.core.exceptions import ValidationError
 

	
 
from django.db import models
...
 
@@ -128,3 +130,6 @@ class Review(models.Model):
 
    vote = models.CharField(max_length=2, blank=True, choices=VOTES.CHOICES, verbose_name=_("Vote"))
 
    comment = models.TextField(verbose_name=_("Comment"))
 
    comment = models.TextField(
 
        blank=True,
 
        verbose_name=_("Comment")
 
    )
 
    comment_html = models.TextField(blank=True)
...
 
@@ -132,2 +137,10 @@ class Review(models.Model):
 

	
 
    def clean(self):
 
        err = {}
 
        if self.vote != VOTES.ABSTAIN and not self.comment.strip():
 
            err["comment"] = ValidationError(_("You must provide a comment"))
 

	
 
        if err:
 
            raise ValidationError(err)
 

	
 
    def save(self, **kwargs):
0 comments (0 inline, 0 general)