On Fri, Nov 2, 2012 at 5:52 PM, Chris Pagnutti <chris.pagnu...@gmail.com> wrote: > Hi. I'm pretty new to Django too, so someone else probably has a better > idea. But I think that on the server side, you can handle additional > validation in the view that handles the form submission (i.e. the view that > the "action" attribute in your form points to). You can probably attach > errors to the form in the view too, so if the form data is invalid you can > display the errors back to the client.
Yeah! I think that is one of the way. :) But I guess it can done at some level at Model validation.. The doc says https://docs.djangoproject.com/en/1.4/topics/forms/modelforms/#overriding-the-clean-method "if you would like to override the clean() method and maintain the _default validation_, you must call the parent class's clean() method." A example would really help... :) > On Friday, November 2, 2012 4:36:20 AM UTC-4, Dilip M wrote: >> >> Hi, >> >> I am new to Django. Went through docs before posting this.. I have a model >> and form like this. >> >> models.py: >> >> class Recipients(models.Model): >> dev = models.EmailField() >> qa = models.EmailField() >> cc = models.MultipleEmailField() >> >> forms.py: >> >> class RecipientsForm(forms.ModelForm): >> >> class Meta: >> model = Recipients >> >> >> Now I want to, >> >> 1. Add *additional* validation for models.EmailField(). Something like >> check if email id entered exists in LDAP db. >> 2. Create new model custom field MultipleEmailField(), which would split >> emails separated by comma and uses modified validation of >> models.EmailField() done in step 1. >> >> I am going through docs, but not able to figure out how to put things >> together! Here is what I understood. >> >> MultipleEmailField() should go in <project-name>/fields.py. But how to >> make it to run default validation of models.EmailField() and than do custom >> validation? >> >> >> Any help appreciated.. -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.