? 11 ?.?. 2553 ???? 23:44 Duane Hilton <dua...@gmail.com> ?????:

> Hi all,
> 
> I'm trying to do some custom validation on a model formset, but I'm
> not having good luck. Thank you in advance for your suggestions ...
> 
> In my views, I have:
> 
> class BaseCandFormSet(BaseModelFormSet):
>    def clean(self):
>        super(BaseCandFormSet, self).clean()
>        for form in self.forms:
>            x = form['x_field']
>            y = form['y_field']
>            if y < x:
>                raise forms.ValidationError('Y cannot be less than x.')
> 
> I get the following error:
> 
> Exception Value: 'list' object has no attribute 'ValidationError'
On my mobile so can't check but I suspect forms is a list of form objects, try 
form.validation error instead...

Good luck!
Jonathan

> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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-us...@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