Fixed #11272 -- Made some clarifications to the overview and tutorial. Thanks to jjinux for the review notes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11044 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
bc362cc6b8
commit
457a1f9a03
|
@ -243,9 +243,9 @@ might look like:
|
||||||
<h1>Articles for {{ year }}</h1>
|
<h1>Articles for {{ year }}</h1>
|
||||||
|
|
||||||
{% for article in article_list %}
|
{% for article in article_list %}
|
||||||
<p>{{ article.headline }}</p>
|
<p>{{ article.headline }}</p>
|
||||||
<p>By {{ article.reporter.full_name }}</p>
|
<p>By {{ article.reporter.full_name }}</p>
|
||||||
<p>Published {{ article.pub_date|date:"F j, Y" }}</p>
|
<p>Published {{ article.pub_date|date:"F j, Y" }}</p>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -238,8 +238,8 @@ the admin page doesn't display choices.
|
||||||
|
|
||||||
Yet.
|
Yet.
|
||||||
|
|
||||||
There are two ways to solve this problem. The first register ``Choice`` with the
|
There are two ways to solve this problem. The first is to register ``Choice``
|
||||||
admin just as we did with ``Poll``. That's easy::
|
with the admin just as we did with ``Poll``. That's easy::
|
||||||
|
|
||||||
from mysite.polls.models import Choice
|
from mysite.polls.models import Choice
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ For more on :class:`~django.http.HttpRequest` objects, see the
|
||||||
:ref:`ref-request-response`. For more details on URLconfs, see the
|
:ref:`ref-request-response`. For more details on URLconfs, see the
|
||||||
:ref:`topics-http-urls`.
|
:ref:`topics-http-urls`.
|
||||||
|
|
||||||
When you ran ``python django-admin.py startproject mysite`` at the beginning of
|
When you ran ``django-admin.py startproject mysite`` at the beginning of
|
||||||
Tutorial 1, it created a default URLconf in ``mysite/urls.py``. It also
|
Tutorial 1, it created a default URLconf in ``mysite/urls.py``. It also
|
||||||
automatically set your :setting:`ROOT_URLCONF` setting (in ``settings.py``) to
|
automatically set your :setting:`ROOT_URLCONF` setting (in ``settings.py``) to
|
||||||
point at that file::
|
point at that file::
|
||||||
|
@ -98,8 +98,7 @@ This is worth a review. When somebody requests a page from your Web site -- say,
|
||||||
the :setting:`ROOT_URLCONF` setting. It finds the variable named ``urlpatterns``
|
the :setting:`ROOT_URLCONF` setting. It finds the variable named ``urlpatterns``
|
||||||
and traverses the regular expressions in order. When it finds a regular
|
and traverses the regular expressions in order. When it finds a regular
|
||||||
expression that matches -- ``r'^polls/(?P<poll_id>\d+)/$'`` -- it loads the
|
expression that matches -- ``r'^polls/(?P<poll_id>\d+)/$'`` -- it loads the
|
||||||
associated Python package/module: ``mysite.polls.views.detail``. That
|
function ``detail()`` from ``mysite/polls/views.py``. Finally,
|
||||||
corresponds to the function ``detail()`` in ``mysite/polls/views.py``. Finally,
|
|
||||||
it calls that ``detail()`` function like so::
|
it calls that ``detail()`` function like so::
|
||||||
|
|
||||||
detail(request=<HttpRequest object>, poll_id='23')
|
detail(request=<HttpRequest object>, poll_id='23')
|
||||||
|
@ -486,7 +485,8 @@ Here's what happens if a user goes to "/polls/34/" in this system:
|
||||||
further processing.
|
further processing.
|
||||||
|
|
||||||
Now that we've decoupled that, we need to decouple the 'mysite.polls.urls'
|
Now that we've decoupled that, we need to decouple the 'mysite.polls.urls'
|
||||||
URLconf by removing the leading "polls/" from each line::
|
URLconf by removing the leading "polls/" from each line, and removing the
|
||||||
|
lines registering the admin site::
|
||||||
|
|
||||||
urlpatterns = patterns('mysite.polls.views',
|
urlpatterns = patterns('mysite.polls.views',
|
||||||
(r'^$', 'index'),
|
(r'^$', 'index'),
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
How to use sessions
|
How to use sessions
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
.. module:: django.contrib.sessions
|
||||||
|
:synopsis: Provides session management for Django projects.
|
||||||
|
|
||||||
Django provides full support for anonymous sessions. The session framework lets
|
Django provides full support for anonymous sessions. The session framework lets
|
||||||
you store and retrieve arbitrary data on a per-site-visitor basis. It stores
|
you store and retrieve arbitrary data on a per-site-visitor basis. It stores
|
||||||
data on the server side and abstracts the sending and receiving of cookies.
|
data on the server side and abstracts the sending and receiving of cookies.
|
||||||
|
|
Loading…
Reference in New Issue