Ticket #5946: 5946.2.diff

File 5946.2.diff, 2.3 KB (added by Marc Fargas, 16 years ago)

Fixed a small typo.

  • docs/tutorial03.txt

    diff --git a/docs/tutorial03.txt b/docs/tutorial03.txt
    index d49a417..8f8576e 100644
    a b first argument to ``patterns()``, like so::  
    402402    urlpatterns = patterns('mysite.polls.views',
    403403        (r'^polls/$', 'index'),
    404404        (r'^polls/(?P<poll_id>\d+)/$', 'detail'),
    405         (r'^polls/(?P<poll_id>\d+)/results/$', 'results'),
    406         (r'^polls/(?P<poll_id>\d+)/vote/$', 'vote'),
     405        #(r'^polls/(?P<poll_id>\d+)/results/$', 'results'),
     406        #(r'^polls/(?P<poll_id>\d+)/vote/$', 'vote'),
    407407    )
    408408
    409409This is functionally identical to the previous formatting. It's just a bit
    410410tidier.
    411411
     412Note that we commented out the ``results`` and ``vote`` patterns as, at this stage,
     413we still have not written those views and Django would give us errors trying to find
     414them.
     415
    412416Decoupling the URLconfs
    413417=======================
    414418
    line::  
    451455    urlpatterns = patterns('mysite.polls.views',
    452456        (r'^$', 'index'),
    453457        (r'^(?P<poll_id>\d+)/$', 'detail'),
    454         (r'^(?P<poll_id>\d+)/results/$', 'results'),
    455         (r'^(?P<poll_id>\d+)/vote/$', 'vote'),
     458        #(r'^(?P<poll_id>\d+)/results/$', 'results'),
     459        #(r'^(?P<poll_id>\d+)/vote/$', 'vote'),
    456460    )
    457461
    458462The idea behind ``include()`` and URLconf decoupling is to make it easy to
  • docs/tutorial04.txt

    diff --git a/docs/tutorial04.txt b/docs/tutorial04.txt
    index bd16fa2..9f2a092 100644
    a b So let's create a ``vote()`` function in ``mysite/polls/views.py``::  
    6969            # user hits the Back button.
    7070            return HttpResponseRedirect(reverse('mysite.polls.views.results', args=(p.id,)))
    7171
     72Remember to uncomment the ``urlpattern`` for ``vote`` that we commented on part
     733 of this tutorial.
     74
    7275This code includes a few things we haven't covered yet in this tutorial:
    7376
    7477    * ``request.POST`` is a dictionary-like object that lets you access
    page for the poll. Let's write that view::  
    120123        p = get_object_or_404(Poll, pk=poll_id)
    121124        return render_to_response('polls/results.html', {'poll': p})
    122125
     126Again, remember to uncomment the ``urlpattern`` for ``results`` that we commented
     127on part 3 of this tutorial.
     128
    123129This is almost exactly the same as the ``detail()`` view from `Tutorial 3`_.
    124130The only difference is the template name. We'll fix this redundancy later.
    125131
Back to Top