Saturday, April 14, 2012

Problems extracting valid form data lately

I don't know what changed but I can't seem to extract valid form data.
(It was working for months previously.)
Below is the function that creates new users when they register.
I store the data in cd. I can print the contents of cd and confirm cd
is a dictionary
but I can't access any values!!!

For example, cd["username"] doesn't access the value for key
"username" but rather
returns the ENTRE cd dict for some reason.

USER = django.contrib.auth.models.User
...


if request.method == "POST":
form = forms.RegisterForm(request.POST)
if form.is_valid():
cd = form.cleaned_data
user = USER(username = cd["username"],
password = "",
email =
cd["parental_email_address"],
first_name =
cd["student_first_name"],
last_name =
cd["student_last_name"])
user.set_password(cd["password"])
user.save()


Any help greatly appreciated.

Sincerely,

Chris

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