From b0d032f9fc3627144fa355158675b6acacab1f23 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Wed, 30 Apr 2014 18:22:43 -0400 Subject: [PATCH] Fixed #22547 -- Added some links to tutorial 2. Thanks bjb at sourcer.ca for the suggestion. --- docs/intro/tutorial02.txt | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/docs/intro/tutorial02.txt b/docs/intro/tutorial02.txt index d3b7cbfd742..23f6440ea55 100644 --- a/docs/intro/tutorial02.txt +++ b/docs/intro/tutorial02.txt @@ -204,7 +204,8 @@ up into fieldsets: admin.site.register(Question, QuestionAdmin) -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 @@ -350,8 +351,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: .. snippet:: :filename: polls/admin.py @@ -396,8 +398,10 @@ attributes, as follows: was_published_recently.boolean = True was_published_recently.short_description = 'Published recently?' -Edit your :file:`polls/admin.py` file again and add an improvement to the Question -change list page: Filters. Add the following line to ``QuestionAdmin``:: +Edit your :file:`polls/admin.py` file again and add an improvement to the +``Question`` change list page: filters using the +:attr:`~django.contrib.admin.ModelAdmin.list_filter`. Add the following line to +``QuestionAdmin``:: list_filter = ['pub_date'] @@ -423,9 +427,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 +`, :attr:`search boxes +`, :attr:`filters +`, :attr:`date-hierarchies +`, and +:attr:`column-header-ordering ` +all work together like you think they should. Customize the admin look and feel =================================