diff options
| author | João Luiz Lorencetti <me@dirtycoder.net> | 2015-05-11 20:43:40 -0300 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-05-28 14:07:39 -0400 |
| commit | 3653466bdf211ca603ec976c28d4a8da566dc671 (patch) | |
| tree | c5b46c951a7f8a9584c401af4a38a80d5dabc5b2 /docs/intro/tutorial04.txt | |
| parent | ad0f0daf8c6aa80775d68068a76c5b6d0fff04ec (diff) | |
Fixed #24732 -- Reordered tutorial to cover basics before bells and whistles.
Diffstat (limited to 'docs/intro/tutorial04.txt')
| -rw-r--r-- | docs/intro/tutorial04.txt | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/docs/intro/tutorial04.txt b/docs/intro/tutorial04.txt index fcacf971cb..cf622c9aec 100644 --- a/docs/intro/tutorial04.txt +++ b/docs/intro/tutorial04.txt @@ -129,18 +129,19 @@ This code includes a few things we haven't covered yet in this tutorial: This function helps avoid having to hardcode a URL in the view function. It is given the name of the view that we want to pass control to and the variable portion of the URL pattern that points to that view. In this - case, using the URLconf we set up in Tutorial 3, this - :func:`~django.core.urlresolvers.reverse` call will return a string like + case, using the URLconf we set up in :doc:`Tutorial 3 </intro/tutorial03>`, + this :func:`~django.core.urlresolvers.reverse` call will return a string like :: '/polls/3/results/' - ... where the ``3`` is the value of ``p.id``. This redirected URL will + where the ``3`` is the value of ``p.id``. This redirected URL will then call the ``'results'`` view to display the final page. -As mentioned in Tutorial 3, ``request`` is a :class:`~django.http.HttpRequest` -object. For more on :class:`~django.http.HttpRequest` objects, see the -:doc:`request and response documentation </ref/request-response>`. +As mentioned in :doc:`Tutorial 3 </intro/tutorial03>`, ``request`` is an +:class:`~django.http.HttpRequest` object. For more on +:class:`~django.http.HttpRequest` objects, see the :doc:`request and +response documentation </ref/request-response>`. After somebody votes in a question, the ``vote()`` view redirects to the results page for the question. Let's write that view: @@ -183,7 +184,7 @@ Use generic views: Less code is better The ``detail()`` (from :doc:`Tutorial 3 </intro/tutorial03>`) and ``results()`` views are very simple -- and, as mentioned above, redundant. The ``index()`` -view (also from Tutorial 3), which displays a list of polls, is similar. +view, which displays a list of polls, is similar. These views represent a common case of basic Web development: getting data from the database according to a parameter passed in the URL, loading a template and @@ -237,8 +238,6 @@ First, open the ``polls/urls.py`` URLconf and change it like so: Note that the name of the matched pattern in the regexes of the second and third patterns has changed from ``<question_id>`` to ``<pk>``. -.. _tutorial04-amend-views: - Amend views ----------- |
