Ticket #4409: 4409.patch

File 4409.patch, 1.7 KB (added by Chris Beaven, 17 years ago)
  • docs/tutorial04.txt

     
    6767            # Always return an HttpResponseRedirect after successfully dealing
    6868            # with POST data. This prevents data from being posted twice if a
    6969            # user hits the Back button.
    70             return HttpResponseRedirect(reverse('results', args=(p.id,)))
     70            return HttpResponseRedirect(reverse(results, args=(p.id,)))
    7171
    7272This code includes a few things we haven't covered yet in this tutorial:
    7373
     
    9696
    9797    * We are using the ``reverse()`` function in the ``HttpResponseRedirect``
    9898      constructor in this example. This function helps avoid having to
    99       hardcode a URL in the view function. It is given the name of the view
    100       that we want to pass control to and the variable portion of the URL
    101       pattern that points to that view. In this case, using the URLConf we set
    102       up in Tutorial 3, this ``reverse()`` call will return a string like ::
     99      hardcode a URL in the view function. It is given the view that we want
     100      to pass control to and the variable portion of the URL pattern that
     101      points to that view. In this case, using the URLConf we set up in
     102      Tutorial 3, this ``reverse()`` call will return a string like ::
    103103
    104104        '/polls/3/results/'
    105105
    106106      ... where the ``3`` is the value of ``p.id``. This redirected URL will
    107       then call the ``'results'`` view to display the final page.
     107      then call the ``results`` view to display the final page.
    108108
    109109      For more information about ``reverse()``, see the `URL dispatcher`_
    110110      documentation.
Back to Top