Ticket #11959: 11959_r11594.diff

File 11959_r11594.diff, 2.6 KB (added by carljm, 5 years ago)

patch to fix admin in tutorial part 3, plus two minor tweaks

  • docs/intro/tutorial02.txt

     
    3535      to :setting:`INSTALLED_APPS`, the database tables need to be updated.
    3636
    3737    * Edit your ``mysite/urls.py`` file and uncomment the lines below the
    38       "Uncomment the next two lines..." comment. This file is a URLconf;
    39       we'll dig into URLconfs in the next tutorial. For now, all you need to
    40       know is that it maps URL roots to applications. In the end, you should
    41       have a ``urls.py`` file that looks like this:
     38      "Uncomment the next... to enable the admin" comments. This file is a
     39      URLconf; we'll dig into URLconfs in the next tutorial. For now, all you
     40      need to know is that it maps URL roots to applications. In the end, you
     41      should have a ``urls.py`` file that looks like this:
    4242
    4343    .. versionchanged:: 1.1
    4444        The method for adding admin urls has changed in Django 1.1.
  • docs/intro/tutorial03.txt

     
    181181Take a look in your browser, at "/polls/34/". It'll display whatever ID you
    182182provide in the URL.
    183183
     184Go ahead and copy that detail view twice and make similar placeholder
     185views named ``vote`` and ``results``. If you have URL patterns that
     186refer to nonexistent views, various other parts of Django (such as the
     187admin interface) won't work properly.
     188
    184189Write views that actually do something
    185190======================================
    186191
     
    467472``mysite/urls.py`` to remove the poll-specific URLs and insert an
    468473:func:`~django.conf.urls.defaults.include`::
    469474
    470     ...
     475    #...
    471476    urlpatterns = patterns('',
    472477        (r'^polls/', include('mysite.polls.urls')),
    473         ...
     478        #...
     479    )
    474480
    475481:func:`~django.conf.urls.defaults.include`, simply, references another URLconf.
    476482Note that the regular expression doesn't have a ``$`` (end-of-string match
  • docs/intro/tutorial04.txt

     
    5252
    5353    (r'^(?P<poll_id>\d+)/vote/$', 'vote'),
    5454
    55 So let's create a ``vote()`` function in ``mysite/polls/views.py``::
     55So let's modify our placeholder ``vote()`` function in
     56``mysite/polls/views.py`` to look like this::
    5657
    5758    from django.shortcuts import get_object_or_404, render_to_response
    5859    from django.http import HttpResponseRedirect
Back to Top