#27947: Document that model field error_messages don't carry over to forms
--------------------------------------+------------------------------------
Reporter: Jimmy Merrild Krag | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Jimmy Merrild Krag):
So how should I override my error messages?
Right now I do
{{{
def __init__(self, *args, **kwargs):
super(MyForm, self).__init__(*args, **kwargs)
# Correct error message for reference field
reference_field = Plan._meta.get_field('reference')
self.fields['reference'].error_messages.update(reference_field.error_messages)
}}}
which I think is ugly
--
Ticket URL: <https://code.djangoproject.com/ticket/27947#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.5b964f83ea99a77b9ba842247ba9c043%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.