#13736: possible example code error ---------------------------+------------------------------------------------ Reporter: ikiini | Owner: nobody Status: new | Milestone: Component: Documentation | Version: 1.2 Keywords: | Stage: Unreviewed Has_patch: 0 | ---------------------------+------------------------------------------------ def contact(request): if request.method == 'POST': # If the form has been submitted... form = ContactForm(request.POST) # A form bound to the POST data if form.is_valid(): # All validation rules pass # Process the data in form.cleaned_data # ... return HttpResponseRedirect('/thanks/') # Redirect after POST else: form = ContactForm() # An unbound form
return render_to_response('contact.html', { 'form': form, }) Notice that the render_to_response uses the form variable that may not have been initialized. this is located at: http://docs.djangoproject.com/en/1.2/topics/forms/#topics-forms-index -- Ticket URL: <http://code.djangoproject.com/ticket/13736> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.