I've never done it myself, but I think you'd just define the clean method
in your Form's class (i.e. in forms.py), and the first line in your clean()
method should call the parent classes, clean() method - to do this you need
to call the super() method, which is just regular python.  It think the
call would look something like this

super(YourFormClass,self).clean()

On Sat, Nov 3, 2012 at 6:55 AM, Dilip M <dilip...@gmail.com> wrote:

> Hi Chris,
>
> Thank you very much for your time on this. I am not able to make out on
> how could I put this under clean() method. Ex: What does "you must call the
> * parent class's clean()"* mean in "if you would like to override the
> clean() method and maintain the _default validation_, you must call the
> parent class's clean() method."
>
> This clean() method will go in models.py? or forms.py? Any simple examples
> would be of great help!
>
> Many thanks...Dilip
>
>
>
> On Fri, Nov 2, 2012 at 8:12 PM, Chris Pagnutti 
> <chris.pagnu...@gmail.com>wrote:
>
>> Ahh.  Just saw your link to overriding the clean() method.  So you could
>> put all the same logic above into the clean() method instead.
>>
>>
>> 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..
>>>
>>>
>>> Thanks. Dilip
>>>
>>
>  --
> 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.
>

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

Reply via email to