Sunday, January 22, 2012

Django Form - This field is required.What am I missing.

Hi I have a form that has a required email field. This due to the fact
that the model requires an email. However, I don't display the email
field on the form. So when the post gets back into my view the email
field is empty. I then thought I would do the following just before
the form.is_valid() :

form = students.forms.StudentForm(request.POST)
form.instance.email=user.email

User is a session variable which contains the correct email for the
session. The above code however still fail with is_valid. I even
changed the forms clean_email() to return the correct email. But, I
still get 'This field is required'.

Any help would be appreciated.

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate