On Jan 11, 2008 10:49 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > I want to manually insert an error into a form from the view using > f.errors (where f is the form in question). For a specific field this > is easy (f.errors['fieldname'] = u'my error here') but I can't seem to > figure out how to make non field errors work. Is there a special > dictionary entry for non field errors, or some other way to do this. I > had a look at the django code but didn't get much further here. Any > suggestions are appreciated. > Take a look at the doc for the Form subclass's clean() method here: http://www.djangoproject.com/documentation/newforms/#custom-form-and-field-validation It would be cleaner to raise the error in a clean() method, but I think the doc includes the information you need to manipulate it yourself if you really want to. (Note you can also customize the error messages for fields, which could get around having to manipulate f.errors['fieldname'] directly, see: http://www.djangoproject.com/documentation/newforms/#error-messages.) Karen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---