If you want to associate an error to a specific field in a model form
then you need to populate self._errors with the error you find. Have a
read about this on the Django docs to see how it is done.

http://docs.djangoproject.com/en/1.1/ref/forms/validation/#ref-forms-validation

The last example shows how to associate a error with a specific field
in a form class.




On Nov 8, 8:40 pm, refreegrata <refreegr...@yahoo.com> wrote:
> Hello list. I want to use the clean method in a model.
> --------------------------------------
> class myModel(models.Model):
>     fields ....
>
>     def clean(self):
>             raise ValidationError('The Error.')
> -------------------------------------------------------
>
> Thats works fine. My question  is, how can I associate this error to
> the field in the modelform?. With this method the form validation can
> be controlled, but I can't pick the error dynamically to show at the
> user.
>
> Thanks for read.

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