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

git-svn-id: http://code.djangoproject.com/svn/django/trunk@555 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-08-26 05:32:30 +00:00
parent 939e2bccd5
commit 3db068f7fa
1 changed files with 13 additions and 7 deletions

View File

@ -86,12 +86,16 @@ But where's our poll app? It's not displayed on the admin index page.
Just one thing to do: We need to specify in the ``polls.Poll`` model that Poll Just one thing to do: We need to specify in the ``polls.Poll`` model that Poll
objects have an admin interface. Edit the ``myproject/apps/polls/models/polls.py`` objects have an admin interface. Edit the ``myproject/apps/polls/models/polls.py``
file and make the following change to add an ``admin`` attribute:: file and make the following change to add an inner ``META`` class with an
``admin`` attribute::
class Poll(meta.Model): class Poll(meta.Model):
# ... # ...
class META:
admin = meta.Admin() admin = meta.Admin()
The ``class META`` contains all non-field metadata about this model.
Now reload the Django admin page to see your changes. Note that you don't have Now reload the Django admin page to see your changes. Note that you don't have
to restart the development server -- it auto-reloads code. to restart the development server -- it auto-reloads code.
@ -216,6 +220,7 @@ Here's what that would look like::
class Choice(meta.Model): class Choice(meta.Model):
# ... # ...
class META:
admin = meta.Admin() admin = meta.Admin()
Now "Choices" is an available option in the Django admin. The "Add choice" form Now "Choices" is an available option in the Django admin. The "Add choice" form
@ -299,6 +304,7 @@ on the change list page for the object::
class Poll(meta.Model): class Poll(meta.Model):
# ... # ...
class META:
admin = meta.Admin( admin = meta.Admin(
# ... # ...
list_display = ('question', 'pub_date'), list_display = ('question', 'pub_date'),