Django

Code

Changeset 430

Show
Ignore:
Timestamp:
08/08/05 10:47:57 (3 years ago)
Author:
adrian
Message:

Made some improvements/clean-ups to docs/tutorial03.txt

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/tutorial03.txt

    r416 r430  
    1010.. _Tutorial 2: http://www.djangoproject.com/documentation/tutorial2/ 
    1111 
    12 .. admonition:: Philosophy 
    13  
    14     A view is a "type" of Web page in your Django application that generally 
    15     serves a specific function and has a specific template. For example, in a 
    16     weblog application, you might have the following views: 
    17  
    18         * Blog homepage -- displays the latest few entries. 
    19         * Entry "detail" page -- permalink page for a single entry. 
    20         * Year-based archive page -- displays all months with entries in the 
    21           given year. 
    22         * Month-based archive page -- displays all days with entries in the 
    23           given month. 
    24         * Day-based archive page -- displays all entries in the given day. 
    25         * Comment action -- handles posting comments to a given entry. 
    26  
    27     In our poll application, we'll have the following four views: 
    28  
    29         * Poll "archive" page -- displays the latest few polls. 
    30         * Poll "detail" page -- displays a poll question, with no results but 
    31           with a form to vote. 
    32         * Poll "results" page -- displays results for a particular poll. 
    33         * Vote action -- handles voting for a particular choice in a particular 
    34           poll. 
    35  
    36     In Django, each view is represented by a simple Python function. 
    37  
    38  
     12Philosophy 
     13========== 
     14 
     15A view is a "type" of Web page in your Django application that generally serves 
     16a specific function and has a specific template. For example, in a weblog 
     17application, you might have the following views: 
     18 
     19    * Blog homepage -- displays the latest few entries. 
     20    * Entry "detail" page -- permalink page for a single entry. 
     21    * Year-based archive page -- displays all months with entries in the 
     22        given year. 
     23    * Month-based archive page -- displays all days with entries in the 
     24        given month. 
     25    * Day-based archive page -- displays all entries in the given day. 
     26    * Comment action -- handles posting comments to a given entry. 
     27 
     28In our poll application, we'll have the following four views: 
     29 
     30    * Poll "archive" page -- displays the latest few polls. 
     31    * Poll "detail" page -- displays a poll question, with no results but 
     32        with a form to vote. 
     33    * Poll "results" page -- displays results for a particular poll. 
     34    * Vote action -- handles voting for a particular choice in a particular 
     35        poll. 
     36 
     37In Django, each view is represented by a simple Python function. 
    3938 
    4039Design your URLs 
     
    131130You should get a Python traceback with the following error message:: 
    132131 
    133     ViewDoesNotExist: Tried myproject.apps.polls.views.polls.index. 
    134     No module named polls 
     132    ViewDoesNotExist: Could not import myproject.apps.polls.views.polls. Error 
     133    was: No module named polls 
    135134 
    136135Try "/polls/23/", "/polls/23/results/" and "/polls/23/vote/". The error 
     
    380379    (r'^polls/', include('myproject.apps.polls.urls.polls')), 
    381380 
    382 Notes: 
    383  
    384381``include()``, simply, references another URLconf. Note that the regular 
    385382expression doesn't have a ``$`` (end-of-string match character) but has the