[1.4.x] Fixed #18614 -- Added imports and changed render_to_response to render.
This commit is contained in:
parent
8ba78a0daf
commit
c6d06a9453
@ -89,6 +89,9 @@ The standard pattern for processing a form in a view looks like this:
|
|||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
from django.shortcuts import render
|
||||||
|
from django.http import HttpResponseRedirect
|
||||||
|
|
||||||
def contact(request):
|
def contact(request):
|
||||||
if request.method == 'POST': # If the form has been submitted...
|
if request.method == 'POST': # If the form has been submitted...
|
||||||
form = ContactForm(request.POST) # A form bound to the POST data
|
form = ContactForm(request.POST) # A form bound to the POST data
|
||||||
@ -99,7 +102,7 @@ The standard pattern for processing a form in a view looks like this:
|
|||||||
else:
|
else:
|
||||||
form = ContactForm() # An unbound form
|
form = ContactForm() # An unbound form
|
||||||
|
|
||||||
return render_to_response('contact.html', {
|
return render(request, 'contact.html', {
|
||||||
'form': form,
|
'form': form,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user