I am trying to customize the error message displayed when a user inputs text longer than the max length for a CharField in my model. The model defines the field as follows:
name = models.CharField(max_length=200) I have a ModelForm for this model that defines the form field as follows:
name = forms.CharField(widget=forms.TextInput(attrs={'class':"span8", 'placeholder':'e.g. How do I setup a wi-fi network? How to sync my iPhone with iCloud?'}), error_messages={'required': 'Please enter a question.', 'max_length': 'Your question is too long.'}) This works fine for the 'required' error message, but the 'max_length' error message still uses Django's default message here. Am I doing something wrong or should this text be customized in some other way?