Made some improvements/clean-ups to docs/tutorial03.txt
git-svn-id: http://code.djangoproject.com/svn/django/trunk@430 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
4003f9f482
commit
03bd1d7ff9
|
@ -9,11 +9,12 @@ application and will focus on creating the public interface -- "views."
|
||||||
|
|
||||||
.. _Tutorial 2: http://www.djangoproject.com/documentation/tutorial2/
|
.. _Tutorial 2: http://www.djangoproject.com/documentation/tutorial2/
|
||||||
|
|
||||||
.. admonition:: Philosophy
|
Philosophy
|
||||||
|
==========
|
||||||
|
|
||||||
A view is a "type" of Web page in your Django application that generally
|
A view is a "type" of Web page in your Django application that generally serves
|
||||||
serves a specific function and has a specific template. For example, in a
|
a specific function and has a specific template. For example, in a weblog
|
||||||
weblog application, you might have the following views:
|
application, you might have the following views:
|
||||||
|
|
||||||
* Blog homepage -- displays the latest few entries.
|
* Blog homepage -- displays the latest few entries.
|
||||||
* Entry "detail" page -- permalink page for a single entry.
|
* Entry "detail" page -- permalink page for a single entry.
|
||||||
|
@ -24,7 +25,7 @@ application and will focus on creating the public interface -- "views."
|
||||||
* Day-based archive page -- displays all entries in the given day.
|
* Day-based archive page -- displays all entries in the given day.
|
||||||
* Comment action -- handles posting comments to a given entry.
|
* Comment action -- handles posting comments to a given entry.
|
||||||
|
|
||||||
In our poll application, we'll have the following four views:
|
In our poll application, we'll have the following four views:
|
||||||
|
|
||||||
* Poll "archive" page -- displays the latest few polls.
|
* Poll "archive" page -- displays the latest few polls.
|
||||||
* Poll "detail" page -- displays a poll question, with no results but
|
* Poll "detail" page -- displays a poll question, with no results but
|
||||||
|
@ -33,9 +34,7 @@ application and will focus on creating the public interface -- "views."
|
||||||
* Vote action -- handles voting for a particular choice in a particular
|
* Vote action -- handles voting for a particular choice in a particular
|
||||||
poll.
|
poll.
|
||||||
|
|
||||||
In Django, each view is represented by a simple Python function.
|
In Django, each view is represented by a simple Python function.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Design your URLs
|
Design your URLs
|
||||||
================
|
================
|
||||||
|
@ -130,8 +129,8 @@ change the ``settings`` parameter.)
|
||||||
Now go to "http://localhost:8000/polls/" on your domain in your Web browser.
|
Now go to "http://localhost:8000/polls/" on your domain in your Web browser.
|
||||||
You should get a Python traceback with the following error message::
|
You should get a Python traceback with the following error message::
|
||||||
|
|
||||||
ViewDoesNotExist: Tried myproject.apps.polls.views.polls.index.
|
ViewDoesNotExist: Could not import myproject.apps.polls.views.polls. Error
|
||||||
No module named polls
|
was: No module named polls
|
||||||
|
|
||||||
Try "/polls/23/", "/polls/23/results/" and "/polls/23/vote/". The error
|
Try "/polls/23/", "/polls/23/results/" and "/polls/23/vote/". The error
|
||||||
messages should tell you which view Django tried (and failed to find, because
|
messages should tell you which view Django tried (and failed to find, because
|
||||||
|
@ -379,8 +378,6 @@ URLs and insert an ``include()``::
|
||||||
|
|
||||||
(r'^polls/', include('myproject.apps.polls.urls.polls')),
|
(r'^polls/', include('myproject.apps.polls.urls.polls')),
|
||||||
|
|
||||||
Notes:
|
|
||||||
|
|
||||||
``include()``, simply, references another URLconf. Note that the regular
|
``include()``, simply, references another URLconf. Note that the regular
|
||||||
expression doesn't have a ``$`` (end-of-string match character) but has the
|
expression doesn't have a ``$`` (end-of-string match character) but has the
|
||||||
trailing slash. Whenever Django encounters ``include()``, it chops off whatever
|
trailing slash. Whenever Django encounters ``include()``, it chops off whatever
|
||||||
|
|
Loading…
Reference in New Issue