Fixed #1833 -- Fixed some errors in tutorials. Thanks, quarkcool@yahoo.fr

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2923 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-05-16 20:45:20 +00:00
parent aa6b13c96b
commit 27612d8b7d
3 changed files with 6 additions and 5 deletions

View File

@ -71,8 +71,8 @@ Make the poll app modifiable in the admin
But where's our poll app? It's not displayed on the admin index page. But where's our poll app? It's not displayed on the admin index page.
Just one thing to do: We need to specify in the ``Poll`` model that ``Poll`` Just one thing to do: We need to specify in the ``Poll`` model that ``Poll``
objects have an admin interface. Edit the ``mysite/polls/models/polls.py`` objects have an admin interface. Edit the ``mysite/polls/models.py`` file and
file and make the following change to add an inner ``Admin`` class:: make the following change to add an inner ``Admin`` class::
class Poll(models.Model): class Poll(models.Model):
# ... # ...

View File

@ -91,7 +91,7 @@ Finally, it calls that ``detail()`` function like so::
The ``poll_id='23'`` part comes from ``(?P<poll_id>\d+)``. Using parenthesis around a The ``poll_id='23'`` part comes from ``(?P<poll_id>\d+)``. Using parenthesis around a
pattern "captures" the text matched by that pattern and sends it as an argument pattern "captures" the text matched by that pattern and sends it as an argument
to the view function; the ``?P<poll_id>`` defines the name that will be used to to the view function; the ``?P<poll_id>`` defines the name that will be used to
identify the matched pattern; and \d+ is a regular experession to match a sequence of identify the matched pattern; and ``\d+`` is a regular experession to match a sequence of
digits (i.e., a number). digits (i.e., a number).
Because the URL patterns are regular expressions, there really is no limit on Because the URL patterns are regular expressions, there really is no limit on

View File

@ -218,8 +218,9 @@ from ``polls/views.py``. We don't need them anymore -- they have been replaced
by generic views. by generic views.
The ``vote()`` view is still required. However, it must be modified to match The ``vote()`` view is still required. However, it must be modified to match
the new templates and context variables. Change the template call from ``polls/detail`` the new templates and context variables. Change the template call from
to ``polls/polls_detail``, and pass ``object`` in the context instead of ``poll``. ``polls/detail.html`` to ``polls/poll_detail.html``, and pass ``object`` in the
context instead of ``poll``.
Run the server, and use your new polling app based on generic views. Run the server, and use your new polling app based on generic views.