On Sunday, 15 April 2012 10:22:43 UTC+1, coded kid wrote:
>
>
> def my_memb(request): 
>         if request.method=="POST": 
>                 form=MembForm(request.POST) 
>                 if form.is_valid(): 
>                         data=form.cleaned_data 
>                         form.save() 
>                 return HttpResponseRedirect('/test/') 
>         else: 
>                 form=MembForm() 
>                 return render_to_response('member.html', 
> {'MembForm':MembForm}, context_instance=RequestContext(request)) 
>
>
Take another look at the code above. If it's a POST, it checks the form's 
validity and if it's valid it saves. But the redirect is being executed 
whether or not the form is valid. It should be fairly clear how to fix that.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/qPwVh6Zl2isJ.
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.

Reply via email to