Re: newforms: how to validate form_for_model ?

2007-11-07 Thread Thomas Guettler

Am Mittwoch, 7. November 2007 12:02 schrieb parabol:
> Hi,
> I have a form class which is generated with form_for_model. How can I
> write my custom validator? I think I should set a clean() method for
> that class. Is it reasonable to say that;
>
> fom1.clean= def clean 

You could set the clean method like this, but this is
a cleaner way:

from django import newforms as forms
class MyForm(forms.BaseForm):
def clean(self):


forms.form_for_model(..., form=MyForm)

Documented here:
http://www.djangoproject.com/documentation/newforms/#using-an-alternate-base-class

 Thomas

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



newforms: how to validate form_for_model ?

2007-11-07 Thread parabol

Hi,
I have a form class which is generated with form_for_model. How can I
write my custom validator? I think I should set a clean() method for
that class. Is it reasonable to say that;

fom1.clean= def clean 

fkoksal


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---