I use ModelForm to create my form. All works fine except 1 thing -
validating the unique field.
Code:
class Article(models.Model):
...
title = models.CharField(max_length=255, unique=True,
error_messages={'max_length' : 'max translation',
'unique' : 'unique translation',
'required' : 'req translation',})
...
class ArticleForm(ModelForm):
...
title = forms.CharField(max_length=255, min_length=3,
error_messages={'required' : 'req translation',
'min_length' : 'min translation',
'max_length' : 'max translation',
'unique' : 'unique translation',})
But when I save my form with non-unique title I don't get my custom
translated error but I get default error. How to fix it, that my unique
field error is displayed?
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en.