Great :). Thanks... Wish i had read your post more thoroughly the first time.
This takes care of my second problem, but what about the first one - why do password fields need to be filled? Because empty(or nonexisting data) fields cannot be compared in 2nd if ? Then what is the syntax for making sure if fields exist in post data? Alan On Jun 8, 3:33 am, Michael <newmani...@gmail.com> wrote: > On Sun, Jun 7, 2009 at 2:54 PM, zayatzz <alan.kesselm...@gmail.com> wrote: > > > Line 43 - if form.is_valid(): > > Line 44 - message = "form valid: " + form.cleaned_data['username'] > > > Alan > > On Jun 7, 9:45 pm, Alex Gaynor <alex.gay...@gmail.com> wrote: > > > On Sun, Jun 7, 2009 at 2:38 PM, zayatzz <alan.kesselm...@gmail.com> > > wrote: > > > > > When the form does pass all that validation i get this error in view : > > > > > Exception Type: TypeError > > > > Exception Value: > > > > 'NoneType' object is unsubscriptable > > > > Exception Location: /home/projects/tst/profile/views.py in > > > > profile_detail, line 44 > > > > > Line 44 is - message = "form valid: " + form.cleaned_data['username'] > > > > > Why? > > > > > Alan > > > > > On Jun 7, 9:20 pm, zayatzz <alan.kesselm...@gmail.com> wrote: > > > > > Thanks to both of you! > > > > > > I changed template form tag to {{ form.as_p }} > > > > > > I figured that since my posting view did not give form to context > > > > > again, but did just redirect, that i had to change this. > > > > > > I also added custom messages to pass to the template from different > > > > > parts of the view - if request is post, if its valid, if its not > > > > > valid. > > > > > > Apparently the form is not valid, but i don't get any validation > > > > > errors in my template. And the root of the problem seems to be > > leaving > > > > > password fields empty. Why? since its not modelform, what other > > > > > validation rules apply tho this form? > > > > > > Alan > > > > That would occur if you tried to subscript form.cleaned_data before > > having > > > testd if form.is_valid(), since cleaned_data doesn't exist until after > > the > > > form has been validated. > > You have to return cleaned_data from the clean method (like I said in my > first response). clean is returning None, thus the fact that you have no > data in your form and you can't loop through it when you try to display it. > > Just put `return data` at the end of you clean function and it should work > as expected. > > Hope that helps, > > Michael --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---