Commit 0b74d089 by Xavier Antoviaque

Answer model - enforce `max_length` above the DB layer (validate save)

parent c83c2dd4
......@@ -38,8 +38,13 @@ class Answer(models.Model):
app_label = 'mentoring'
unique_together = (('student_id', 'name'),)
name = models.CharField(max_length=20, db_index=True)
name = models.CharField(max_length=50, db_index=True)
student_id = models.CharField(max_length=20, db_index=True)
student_input = models.CharField(max_length=10000, blank=True, default='')
created_on = models.DateTimeField('created on', auto_now_add=True)
modified_on = models.DateTimeField('modified on', auto_now=True)
def save(self, *args, **kwargs):
# Force validation of max_length
self.full_clean()
super(Answer, self).save(*args, **kwargs)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment