~ubuntu-branches/ubuntu/jaunty/python-django/jaunty-backports

« back to all changes in this revision

Viewing changes to docs/intro/tutorial04.txt

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2008-11-15 19:15:33 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20081115191533-xbt1ut2xf4fvwtvc
Tags: 1.0.1-0ubuntu1
* New upstream release:
  - Bug fixes.

* The tests/ sub-directory appaers to have been dropped upstream, so pull
  our patch to workaround the tests and modify the rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
      data server-side, use ``method="post"``. This tip isn't specific to
44
44
      Django; it's just good Web development practice.
45
45
 
46
 
    * ``forloop.counter`` indicates how many times the ;ttag:`for` tag has gone
 
46
    * ``forloop.counter`` indicates how many times the :ttag:`for` tag has gone
47
47
      through its loop
48
48
 
49
49
Now, let's create a Django view that handles the submitted data and does
112
112
      This function helps avoid having to hardcode a URL in the view function.
113
113
      It is given the name of the view that we want to pass control to and the
114
114
      variable portion of the URL pattern that points to that view. In this
115
 
      case, using the URLConf we set up in Tutorial 3, this
 
115
      case, using the URLconf we set up in Tutorial 3, this
116
116
      :func:`~django.core.urlresolvers.reverse` call will return a string like
117
117
      ::
118
118
 
268
268
However, the generic views provide the variables ``object`` and ``object_list``
269
269
as context. Therefore, you need to change your templates to match the new
270
270
context variables. Go through your templates, and modify any reference to
271
 
``latest_poll_list`` to :func:`~django.views.generic.list_detail.object_list`,
272
 
and change any reference to ``poll`` to ``object``.
 
271
``latest_poll_list`` to ``object_list``, and change any reference to ``poll``
 
272
to ``object``.
273
273
 
274
274
You can now delete the ``index()``, ``detail()`` and ``results()`` views
275
275
from ``polls/views.py``. We don't need them anymore -- they have been replaced