Friday, September 3, 2010

Customising errors in a form according to user region

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

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

No comments:

Post a Comment