Re: Adding errors to form after successful validation

2011-07-11 Thread Brian McKeever
I am now doing my query in the form's clean method, and it errors the way I want it to. Thank you. Although, I do feel dirty doing it this way. I feel like I should be able to append an error to the form in the view. On Jul 11, 3:04 pm, Andre Terra wrote: > I feel your pain, validating forms can

Re: Adding errors to form after successful validation

2011-07-11 Thread Andre Terra
I feel your pain, validating forms can be a PITA... Try reading through this last bit of the form validation docs: https://docs.djangoproject.com/en/dev/ref/forms/validation/#cleaning-and-validating-fields-that-depend-on-each-other Cheers, André Terra On Mon, Jul 11, 2011 at 6:02 PM, Brian McKe

Adding errors to form after successful validation

2011-07-11 Thread Brian McKeever
I have a search form that is used by a view to search for results and then redirect to display them one at a time. If my search doesn't find any objects matching the criteria, I'd like to display a message saying so. It seems natural to add this error to the search form and redisplay it since it a

Re: Adding errors

2009-08-04 Thread Alex Gaynor
On Tue, Aug 4, 2009 at 11:17 AM, CrabbyPete wrote: > > I want to return an error that a user was not found. I wanted to add > the error and have it formatted using errorlist as happens with a > required field. So I did the following > > lform._errors['username']  = ErrorList("User does not exist o

Adding errors

2009-08-04 Thread CrabbyPete
I want to return an error that a user was not found. I wanted to add the error and have it formatted using errorlist as happens with a required field. So I did the following lform._errors['username'] = ErrorList("User does not exist or wrong password") The result in lform.errors is ErrorDict:

Re: adding errors to forms

2009-05-23 Thread Sam Chuparkoff
The reference you want is here: http://docs.djangoproject.com/en/dev/ref/forms/validation/#form-subclasses-and-modifying-field-errors Note particularly those first few paragraphs under 'Form subclasses and modifying field errors', and examples below. sdc --~--~-~--~~~--

Re: adding errors to forms

2009-05-23 Thread Reiner
I think the errors attribute needs to be a list (hence the name), so try: form._errors['name'].append('User name already in use') I think errors is not only a list, but an instance of django.forms.utils.ErrorList (or any subclass of it), which controls the way errors are displayed in the form, a

adding errors to forms

2009-05-22 Thread CrabbyPete
If I have a form and if form.is_valid is False The code code in the template {{ form.name.errors}} formats the error like this. This field is required. How do you add an error so it gets formatted with the surrounding html. If a user name already exists I want to add the error message 'User na

Re: Adding errors into the form?

2006-01-08 Thread Ian Holsman
On 1/6/06, FX <[EMAIL PROTECTED]> wrote: > > Hi Ian, > Thanks for the prompt reply. (which time zone are you in?) I live in Melbourne Australia. > > I made some modifications to your Django Captcha that might be useful, > so I'm attaching the patch (generated by svn) below. The changes are: > 1.

Re: Adding errors into the form?

2006-01-05 Thread FX
Hi Ian, Thanks for the prompt reply. (which time zone are you in?) I made some modifications to your Django Captcha that might be useful, so I'm attaching the patch (generated by svn) below. The changes are: 1. modified to make use of tempfile.mkdtemp() and tempfile.tempdir instead of "/tmp" to m

Re: Adding errors into the form?

2006-01-05 Thread Ian Holsman
Hi Feiyu. the problem is the captcha validation is the manipulator out of scope when the the validation is run. there are 2 choices. 1. the captcha view should throw a validation error (not a 404).. thats my bug, and I will fix it shortly. This will mean you will get the error message on your

Adding errors into the form?

2006-01-05 Thread FX
Folks, I'm working on an application that makes use of Django Captcha. I want to be able to display the captcha validation error along with other errors on the form after post, and here is my view code (please note the story model is the same as django.models.storys so the manipulator is django.mo