Django

Code

Changeset 2776

Show
Ignore:
Timestamp:
04/28/06 20:10:16 (2 years ago)
Author:
adrian
Message:

magic-removal: Fixed #1704, #1682, #1693, #1694, #1695, #1696 -- Made corrections to tutorials. Thanks, Malcolm and crew

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/docs/tutorial01.txt

    r2725 r2776  
    450450    >>> p.save() 
    451451 
    452     # get_list() displays all the polls in the database. 
     452    # objects.all() displays all the polls in the database. 
    453453    >>> Poll.objects.all() 
    454454    [<Poll object>] 
  • django/branches/magic-removal/docs/tutorial03.txt

    r2707 r2776  
    361361    <h1>{{ poll.question }}</h1> 
    362362    <ul> 
    363     {% for choice in poll.get_choice_list %} 
     363    {% for choice in poll.choice_set.all %} 
    364364        <li>{{ choice.choice }}</li> 
    365365    {% endfor %} 
     
    372372method ``question()`` on the poll object. 
    373373 
    374 Method-calling happens in the ``{% for %}`` loop: ``poll.get_choice_list`` is 
    375 interpreted as the Python code ``poll.get_choice_list()``, which returns a list 
    376 of Choice objects and is suitable for iteration via the ``{% for %}`` tag. 
     374Method-calling happens in the ``{% for %}`` loop: ``poll.choice_set.all`` is 
     375interpreted as the Python code ``poll.choice_set.all()``, which returns an 
     376iterable of Choice objects and is suitable for use in the ``{% for %}`` tag. 
    377377 
    378378See the `template guide`_ for full details on how templates work. 
  • django/branches/magic-removal/docs/tutorial04.txt

    r2774 r2776  
    4040 
    4141Now, let's create a Django view that handles the submitted data and does 
    42 something with it. Remember, in `Tutorial 3`_, we create a URLconf for the 
     42something with it. Remember, in `Tutorial 3`_, we created a URLconf for the 
    4343polls application that includes this line:: 
    4444 
     
    152152    You should know basic math before you start using a calculator. 
    153153 
    154 First, open the polls.py URLconf. It looks like this, according to the tutorial 
    155 so far:: 
     154First, open the polls/urls.py URLconf. It looks like this, according to the 
     155tutorial so far:: 
    156156 
    157157    from django.conf.urls.defaults import * 
     
    176176        (r'^$', 'django.views.generic.list_detail.object_list', info_dict), 
    177177        (r'^(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', info_dict), 
    178         (r'^(?P<object_id>\d+)/results/$', 'django.views.generic.list_detail.object_detail', dict(info_dict, template_name='polls/results')), 
     178        (r'^(?P<object_id>\d+)/results/$', 'django.views.generic.list_detail.object_detail', dict(info_dict, template_name='polls/results.html')), 
    179179        (r'^(?P<poll_id>\d+)/vote/$', 'mysite.polls.views.vote'), 
    180180    ) 
     
    204204Because we have more than one entry in the URLconf that uses ``object_detail`` 
    205205for the polls app, we manually specify a template name for the results view: 
    206 ``template_name='polls/results'``. Otherwise, both views would use the same 
     206``template_name='polls/results.html'``. Otherwise, both views would use the same 
    207207template. Note that we use ``dict()`` to return an altered dictionary in place. 
    208208