diff options
| author | Tim Graham <timograham@gmail.com> | 2014-04-30 18:26:04 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-04-30 18:26:04 -0400 |
| commit | c1692fa25a6954616cb86c2166ae6bc9759c5341 (patch) | |
| tree | 5541ba56fff8b71d507e140c44181a9db6024d4a /docs | |
| parent | 2a0f942cbd779e351100086a6183f648b1e4aa14 (diff) | |
[1.6.x] Fixed #22547 -- Added some links to tutorial 2.
Thanks bjb at sourcer.ca for the suggestion.
Backport of b0d032f9fc from master
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/intro/tutorial02.txt | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/docs/intro/tutorial02.txt b/docs/intro/tutorial02.txt index 6e6423cf55..18afed79b4 100644 --- a/docs/intro/tutorial02.txt +++ b/docs/intro/tutorial02.txt @@ -193,7 +193,8 @@ up into fieldsets:: admin.site.register(Poll, PollAdmin) -The first element of each tuple in ``fieldsets`` is the title of the fieldset. +The first element of each tuple in +:attr:`~django.contrib.admin.ModelAdmin.fieldsets` is the title of the fieldset. Here's what our form looks like now: .. image:: _images/admin08t.png @@ -323,8 +324,9 @@ Here's what it looks like at this point: By default, Django displays the ``str()`` of each object. But sometimes it'd be more helpful if we could display individual fields. To do that, use the -``list_display`` admin option, which is a tuple of field names to display, as -columns, on the change list page for the object:: +:attr:`~django.contrib.admin.ModelAdmin.list_display` admin option, which is a +tuple of field names to display, as columns, on the change list page for the +object:: class PollAdmin(admin.ModelAdmin): # ... @@ -361,7 +363,9 @@ attributes, as follows:: was_published_recently.short_description = 'Published recently?' Edit your :file:`polls/admin.py` file again and add an improvement to the Poll -change list page: Filters. Add the following line to ``PollAdmin``:: +change list page: filters using the +:attr:`~django.contrib.admin.ModelAdmin.list_filter` attribute. Add the +following line to ``PollAdmin``:: list_filter = ['pub_date'] @@ -387,9 +391,13 @@ scenes, limiting the number of search fields to a reasonable number will make it easier for your database to do the search. Now's also a good time to note that change lists give you free pagination. The -default is to display 100 items per page. Change-list pagination, search boxes, -filters, date-hierarchies and column-header-ordering all work together like you -think they should. +default is to display 100 items per page. :attr:`Change-list pagination +<django.contrib.admin.ModelAdmin.list_per_page>`, :attr:`search boxes +<django.contrib.admin.ModelAdmin.search_fields>`, :attr:`filters +<django.contrib.admin.ModelAdmin.list_filter>`, :attr:`date-hierarchies +<django.contrib.admin.ModelAdmin.date_hierarchy>`, and +:attr:`column-header-ordering <django.contrib.admin.ModelAdmin.list_display>` +all work together like you think they should. Customize the admin look and feel ================================= |
