diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-11-16 02:00:23 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-11-16 02:00:23 +0000 |
| commit | 464e84257d1e61468bc6ddd3cc5ed0343ec6b047 (patch) | |
| tree | 6e929fd88d96be909e3ffc94d13ae2def574ad61 /docs/tutorial04.txt | |
| parent | a469d821a12fc337d534cb9d499942296c1bd126 (diff) | |
| download | django-464e84257d1e61468bc6ddd3cc5ed0343ec6b047.tar.gz | |
Changed 'django-admin.py startapp' application template to use views.py instead of views package, for simplicity. Updated tutorial to reflect the change.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1258 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/tutorial04.txt')
| -rw-r--r-- | docs/tutorial04.txt | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/docs/tutorial04.txt b/docs/tutorial04.txt index 4f9ef3baff..7acb1343eb 100644 --- a/docs/tutorial04.txt +++ b/docs/tutorial04.txt @@ -44,9 +44,9 @@ Now, let's create a Django view that handles the submitted data and does something with it. Remember, in `Tutorial 3`_, we create a URLconf that included this line:: - (r'^polls/(?P<poll_id>\d+)/vote/$', 'myproject.apps.polls.views.polls.vote'), + (r'^polls/(?P<poll_id>\d+)/vote/$', 'myproject.apps.polls.views.vote'), -So let's create a ``vote()`` function in ``myproject/apps/polls/views/polls.py``:: +So let's create a ``vote()`` function in ``myproject/apps/polls/views.py``:: from django.core.extensions import get_object_or_404, render_to_response from django.models.polls import choices, polls @@ -158,7 +158,7 @@ so far:: from django.conf.urls.defaults import * - urlpatterns = patterns('myproject.apps.polls.views.polls', + urlpatterns = patterns('myproject.apps.polls.views', (r'^$', 'index'), (r'^(?P<poll_id>\d+)/$', 'detail'), (r'^(?P<poll_id>\d+)/results/$', 'results'), @@ -178,7 +178,7 @@ Change it like so:: (r'^$', 'django.views.generic.list_detail.object_list', info_dict), (r'^(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', info_dict), (r'^(?P<object_id>\d+)/results/$', 'django.views.generic.list_detail.object_detail', dict(info_dict, template_name='polls/results')), - (r'^(?P<poll_id>\d+)/vote/$', 'myproject.apps.polls.views.polls.vote'), + (r'^(?P<poll_id>\d+)/vote/$', 'myproject.apps.polls.views.vote'), ) We're using two generic views here: ``object_list`` and ``object_detail``. @@ -217,7 +217,7 @@ In the ``vote()`` view, change the template call from ``polls/detail`` to ``polls/polls_detail``, and pass ``object`` in the context instead of ``poll``. Finally, you can delete the ``index()``, ``detail()`` and ``results()`` views -from ``polls/views/polls.py``. We don't need them anymore. +from ``polls/views.py``. We don't need them anymore. For full details on generic views, see the `generic views documentation`_. |
