Error message customization

1 view
Skip to first unread message

dr.NO

unread,
Nov 25, 2009, 7:09:02 AM11/25/09
to Django users
Hi,

How can i display field name using verbose_name not just field name in
validation of ModelForm ?

For egz.

shipping_character = models.CharField('Your game character name
',max_length=50) <-- field from model

if it's empty validatior error is shipping_character - field is
required
and i want it to be
Your game character name - filed is required

Benjamin Wolf

unread,
Nov 25, 2009, 9:23:30 AM11/25/09
to django...@googlegroups.com
Hi,
use a normal form and do it like this:
shipping_character = forms.CharField(error_messages={'required': 'Your
game character name'}, label='Charakter Name')

dr.NO schrieb:
> --
>
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>
>
>

Reply all
Reply to author
Forward
0 new messages