Customising errors in a form according to user region

2 views
Skip to first unread message

Sithembewena Lloyd Dube

unread,
Sep 3, 2010, 8:07:29 AM9/3/10
to django...@googlegroups.com
Hi folks,

I have a Django form defined as follows:

class SubscriberForm(ModelForm):
     class Meta:
          model = Subscriber

The Subscriber model is as follows:

class Subscriber(models.Model):
     name =                        models.CharField(max_length=255)
     surname =                     models.CharField(max_length=255)
     email =                       models.EmailField()

     def __unicode__(self):
        return self.name

Basically, I wish to validate the name, surname and email fields when a user hits submit on the form. However, I need to show validation messages in the appropriate language based on the user's selected region. How would I customise the form object's validation messages?

Thanks!

--
Regards,
Sithembewena Lloyd Dube
http://www.lloyddube.com

Kenneth Gonsalves

unread,
Sep 3, 2010, 8:09:59 AM9/3/10
to django...@googlegroups.com
On Fri, 2010-09-03 at 14:07 +0200, Sithembewena Lloyd Dube wrote:
> Basically, I wish to validate the name, surname and email fields when
> a user
> hits submit on the form. However, I need to show validation messages
> in the
> appropriate language based on the user's selected region. How would I
> customise the form object's validation messages?

use i18n (look up internationalization and localization in the docs)
--
regards
Kenneth Gonsalves

Sithembewena Lloyd Dube

unread,
Sep 3, 2010, 9:07:25 AM9/3/10
to django...@googlegroups.com
Thanks Kenneth!


--
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