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. > > Alex > > -- > "I disapprove of what you say, but I will defend to the death your right to > say it." --Voltaire > "The people's good is the highest law."--Cicero --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---