From 07b42f223470083df70134d3dfb3507b20bff768 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Sat, 29 Apr 2006 01:10:16 +0000 Subject: [PATCH] magic-removal: Fixed #1704, #1682, #1693, #1694, #1695, #1696 -- Made corrections to tutorials. Thanks, Malcolm and crew git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2776 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/tutorial01.txt | 2 +- docs/tutorial03.txt | 8 ++++---- docs/tutorial04.txt | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/tutorial01.txt b/docs/tutorial01.txt index 75f3f090c1..8ce9f6539d 100644 --- a/docs/tutorial01.txt +++ b/docs/tutorial01.txt @@ -449,7 +449,7 @@ Once you're in the shell, explore the database API:: >>> p.pub_date = datetime(2005, 4, 1, 0, 0) >>> p.save() - # get_list() displays all the polls in the database. + # objects.all() displays all the polls in the database. >>> Poll.objects.all() [] diff --git a/docs/tutorial03.txt b/docs/tutorial03.txt index 2896bc1e2f..6433831a73 100644 --- a/docs/tutorial03.txt +++ b/docs/tutorial03.txt @@ -360,7 +360,7 @@ what the template might look like::

{{ poll.question }}

@@ -371,9 +371,9 @@ on the object ``poll``. Failing that, it tries attribute lookup -- which works, in this case. If attribute lookup had failed, it would've tried calling the method ``question()`` on the poll object. -Method-calling happens in the ``{% for %}`` loop: ``poll.get_choice_list`` is -interpreted as the Python code ``poll.get_choice_list()``, which returns a list -of Choice objects and is suitable for iteration via the ``{% for %}`` tag. +Method-calling happens in the ``{% for %}`` loop: ``poll.choice_set.all`` is +interpreted as the Python code ``poll.choice_set.all()``, which returns an +iterable of Choice objects and is suitable for use in the ``{% for %}`` tag. See the `template guide`_ for full details on how templates work. diff --git a/docs/tutorial04.txt b/docs/tutorial04.txt index 47f9810547..67974327a3 100644 --- a/docs/tutorial04.txt +++ b/docs/tutorial04.txt @@ -39,7 +39,7 @@ A quick rundown: Django; it's just good Web development practice. 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 for the +something with it. Remember, in `Tutorial 3`_, we created a URLconf for the polls application that includes this line:: (r'^(?P\d+)/vote/$', 'mysite.polls.views.vote'), @@ -151,8 +151,8 @@ conversion. You should know basic math before you start using a calculator. -First, open the polls.py URLconf. It looks like this, according to the tutorial -so far:: +First, open the polls/urls.py URLconf. It looks like this, according to the +tutorial so far:: from django.conf.urls.defaults import * @@ -175,7 +175,7 @@ Change it like so:: urlpatterns = patterns('', (r'^$', 'django.views.generic.list_detail.object_list', info_dict), (r'^(?P\d+)/$', 'django.views.generic.list_detail.object_detail', info_dict), - (r'^(?P\d+)/results/$', 'django.views.generic.list_detail.object_detail', dict(info_dict, template_name='polls/results')), + (r'^(?P\d+)/results/$', 'django.views.generic.list_detail.object_detail', dict(info_dict, template_name='polls/results.html')), (r'^(?P\d+)/vote/$', 'mysite.polls.views.vote'), ) @@ -203,7 +203,7 @@ Similarly, the ``object_list`` generic view uses a template called Because we have more than one entry in the URLconf that uses ``object_detail`` for the polls app, we manually specify a template name for the results view: -``template_name='polls/results'``. Otherwise, both views would use the same +``template_name='polls/results.html'``. Otherwise, both views would use the same template. Note that we use ``dict()`` to return an altered dictionary in place. In previous versions of the tutorial, the templates have been provided with a context