Re: Overide error messages in models
There's self._meta._fields() that you can call to get a list of fields
defined in that models but all the error_messages property attached to
that field is just a proxy object to something else. I try the
following in model's __init__ but it doesn't has any effect:-
class Thread(models.Model):
field1 = models.CharField(max_length=255)
field2 = ...
def __init__(self, *args, **kwargs):
super(Thread, self).__init__(*args, **kwargs)
for f in self._meta._fields():
if 'blank' in f.error_messages:
f.error_messages['blank'] = 'Needed.'
sorry can't dig further ...
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home