]> git.parisson.com Git - teleforma.git/commitdiff
add answer validate
authoryomguy <yomguy@parisson.com>
Wed, 17 Oct 2012 13:29:02 +0000 (15:29 +0200)
committeryomguy <yomguy@parisson.com>
Wed, 17 Oct 2012 13:29:02 +0000 (15:29 +0200)
teleforma/models/pro.py

index 83bf9edcf07459d4b3a290d28389a8f603d2cfb7..e2e1852eec0796c04d75e50a067c401f9cc1edaa 100644 (file)
@@ -106,6 +106,11 @@ class Answer(Model):
     def __unicode__(self):
         return ' - '.join([self.question, self.user])
 
+    def validate(self):
+        if len(self.answer) >= self.question.min_nchar:
+            self.validated = True
+            self.save()
+
     class Meta(MetaCore):
         db_table = app_label + '_' + 'answer'
         verbose_name = _('Answer')