summaryrefslogtreecommitdiff
path: root/docs/intro/tutorial04.txt
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2013-02-07 05:51:25 -0500
committerTim Graham <timograham@gmail.com>2013-02-07 07:05:36 -0500
commitaa85ccf8ce11c4b8374c74fd9dfe72647be49ada (patch)
tree4e68ef43ea9f82b93b23acf5267e35c18c2c6fce /docs/intro/tutorial04.txt
parent43efefae692729925c0f75c55e93bd1f33f42bfd (diff)
Fixed #19706 - Tweaks to the tutorial.
Thanks Daniele Procida.
Diffstat (limited to 'docs/intro/tutorial04.txt')
-rw-r--r--docs/intro/tutorial04.txt15
1 files changed, 11 insertions, 4 deletions
diff --git a/docs/intro/tutorial04.txt b/docs/intro/tutorial04.txt
index f047067aa7..87d8e584ad 100644
--- a/docs/intro/tutorial04.txt
+++ b/docs/intro/tutorial04.txt
@@ -33,7 +33,7 @@ A quick rundown:
``value`` of each radio button is the associated poll choice's ID. The
``name`` of each radio button is ``"choice"``. That means, when somebody
selects one of the radio buttons and submits the form, it'll send the
- POST data ``choice=3``. This is HTML Forms 101.
+ POST data ``choice=3``. This is the basic concept of HTML forms.
* We set the form's ``action`` to ``{% url 'polls:vote' poll.id %}``, and we
set ``method="post"``. Using ``method="post"`` (as opposed to
@@ -199,6 +199,9 @@ Read on for details.
You should know basic math before you start using a calculator.
+Amend URLconf
+-------------
+
First, open the ``polls/urls.py`` URLconf and change it like so::
from django.conf.urls import patterns, url
@@ -225,6 +228,9 @@ First, open the ``polls/urls.py`` URLconf and change it like so::
url(r'^(?P<poll_id>\d+)/vote/$', 'polls.views.vote', name='vote'),
)
+Amend views
+-----------
+
We're using two generic views here:
:class:`~django.views.generic.list.ListView` and
:class:`~django.views.generic.detail.DetailView`. Respectively, those
@@ -267,9 +273,10 @@ As an alternative approach, you could change your templates to match
the new default context variables -- but it's a lot easier to just
tell Django to use the variable you want.
-You can now delete the ``index()``, ``detail()`` and ``results()``
-views from ``polls/views.py``. We don't need them anymore -- they have
-been replaced by generic views.
+You can now delete the ``index()``, ``detail()`` and ``results()`` views from
+``polls/views.py``. We don't need them anymore -- they have been replaced by
+generic views. You can also delete the import for ``HttpResponse``, which is no
+longer required.
Run the server, and use your new polling app based on generic views.