Django TextField max_length validation for ModelForm

As of Django 1.2 this can be done by validators at model level, as explained here:
https://docs.djangoproject.com/en/stable/ref/validators/

from django.core.validators import MaxLengthValidator

class Comment(models.Model):
    comment = models.TextField(validators=[MaxLengthValidator(200)])

Since Django 1.7, you can use max_length which is only enforced in client side. See here

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)