Google Groups

Re: Model forms error messages

Karol Sikora May 2, 2012 2:50 PM
Posted in group: Django developers (Contributions to Django itself)
Here is my use case.

Model field definition:
    blog_url = models.URLField(verbose_name=u'Blog', blank=True, error_messages={'invalid': u'Adres bloga nie jest prawidłowy'})
To define error messages in form I have to write:
 blog_url = forms.CharField(error_messages={'invalid': u'Adres bloga nie jest prawidłowy'}, label=u'Blog', required=False)

So there are 3 DRY violation in one field(label - verbose_name, required - blank, error_messages - error messages)!
I can't understand why all remaining model option are translated to corresponding fields, but error_messages not. 
In my opinion this is a serious bug, not only feature request.