Re: ModelForm using Model error_messages

68 views
Skip to first unread message

Loic Bistuer

unread,
Mar 11, 2013, 12:52:03 PM3/11/13
to django-d...@googlegroups.com
This is more or less the idea behind https://code.djangoproject.com/ticket/20000 except that the custom error_messages would be defined in ModelForm rather than Model. In my opinion, Model is a terrible place to define user-facing strings such as help_text or error_messages, at best useful to supply default values.

From a quick glance at the code, we might need some special handling to override the error_messages defined in model fields. I would tackle that if #20000 were to be accepted.

I'll write more thoroughly about #20000 once the discussion about Bruno's proposal (ref. #12915) has settled.

-- 
Loic

On Mar 11, 2013, at 8:50 PM, Nicolas Diaz Aragon <nico.dia...@gmail.com> wrote:

If the 'error_messages' attribute were also included, then there'd be just one place to define all your error messages: the model. This makes cleaner code, because you know there's only one way to look for error messages.

Reply all
Reply to author
Forward
0 new messages