Django

Code

Changeset 555

Show
Ignore:
Timestamp:
08/26/05 00:32:30 (3 years ago)
Author:
adrian
Message:

Fixed bug in docs/tutorial02.txt related to model syntax change. Thanks, Jeremy

Files:

Legend:

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

    r549 r555  
    8787Just one thing to do: We need to specify in the ``polls.Poll`` model that Poll 
    8888objects have an admin interface. Edit the ``myproject/apps/polls/models/polls.py`` 
    89 file and make the following change to add an ``admin`` attribute:: 
     89file and make the following change to add an inner ``META`` class with an 
     90``admin`` attribute:: 
    9091 
    9192    class Poll(meta.Model): 
    9293        # ... 
    93         admin = meta.Admin() 
     94        class META: 
     95            admin = meta.Admin() 
     96 
     97The ``class META`` contains all non-field metadata about this model. 
    9498 
    9599Now reload the Django admin page to see your changes. Note that you don't have 
     
    217221    class Choice(meta.Model): 
    218222        # ... 
    219         admin = meta.Admin() 
     223        class META: 
     224            admin = meta.Admin() 
    220225 
    221226Now "Choices" is an available option in the Django admin. The "Add choice" form 
     
    300305    class Poll(meta.Model): 
    301306        # ... 
    302         admin = meta.Admin( 
    303             # ... 
    304             list_display = ('question', 'pub_date'), 
    305         ) 
     307        class META: 
     308            admin = meta.Admin( 
     309                # ... 
     310                list_display = ('question', 'pub_date'), 
     311            ) 
    306312 
    307313Just for good measure, let's also include the ``was_published_today`` custom