summaryrefslogtreecommitdiff
path: root/docs/tutorial02.txt
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2005-08-26 05:32:30 +0000
committerAdrian Holovaty <adrian@holovaty.com>2005-08-26 05:32:30 +0000
commit3db068f7fa974ad9c5838967ab7c238061ece93d (patch)
tree20ffa01b6bb90f24d2a2e32ed156877c48636ec3 /docs/tutorial02.txt
parent939e2bccd536c69681946901348bf35c909aad9f (diff)
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
Diffstat (limited to 'docs/tutorial02.txt')
-rw-r--r--docs/tutorial02.txt20
1 files changed, 13 insertions, 7 deletions
diff --git a/docs/tutorial02.txt b/docs/tutorial02.txt
index e1d0401592..7cd26494a8 100644
--- a/docs/tutorial02.txt
+++ b/docs/tutorial02.txt
@@ -86,11 +86,15 @@ 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
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):
# ...
- admin = meta.Admin()
+ class META:
+ 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
to restart the development server -- it auto-reloads code.
@@ -216,7 +220,8 @@ Here's what that would look like::
class Choice(meta.Model):
# ...
- admin = meta.Admin()
+ class META:
+ admin = meta.Admin()
Now "Choices" is an available option in the Django admin. The "Add choice" form
looks like this:
@@ -299,10 +304,11 @@ on the change list page for the object::
class Poll(meta.Model):
# ...
- admin = meta.Admin(
- # ...
- list_display = ('question', 'pub_date'),
- )
+ class META:
+ admin = meta.Admin(
+ # ...
+ list_display = ('question', 'pub_date'),
+ )
Just for good measure, let's also include the ``was_published_today`` custom
method from Tutorial 1::