Django

Code

Changeset 7683

Show
Ignore:
Timestamp:
06/17/08 17:00:48 (5 months ago)
Author:
brosner
Message:

newforms-admin: Allowed for another heading level in docs/admin.txt. Also fixed up some other issues caught by generating the documentation.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/newforms-admin/docs/admin.txt

    r7626 r7683  
    4747    admin.site.register(Author, AuthorAdmin) 
    4848 
     49``ModelAdmin`` Options 
     50---------------------- 
     51 
    4952The ``ModelAdmin`` is very flexible. It has several options for dealing with 
    5053customizing the interface. All options are defined on the ``ModelAdmin`` 
     
    5558 
    5659``date_hierarchy`` 
    57 ------------------ 
     60~~~~~~~~~~~~~~~~~~ 
    5861 
    5962Set ``date_hierarchy`` to the name of a ``DateField`` or ``DateTimeField`` in 
     
    6669 
    6770``fieldsets`` 
    68 ------------- 
     71~~~~~~~~~~~~~ 
    6972 
    7073Set ``fieldsets`` to control the layout of admin "add" and "change" pages. 
     
    103106 
    104107``fields`` 
    105 ~~~~~~~~~~ 
    106  
    107 A tuple of field names to display in this fieldset. This key is required. 
    108  
    109 Example:: 
    110  
    111     { 
    112     'fields': ('first_name', 'last_name', 'address', 'city', 'state'), 
    113     } 
    114  
    115 To display multiple fields on the same line, wrap those fields in their own 
    116 tuple. In this example, the ``first_name`` and ``last_name`` fields will 
    117 display on the same line:: 
    118  
    119     { 
    120     'fields': (('first_name', 'last_name'), 'address', 'city', 'state'), 
    121     } 
     108    A tuple of field names to display in this fieldset. This key is required. 
     109     
     110    Example:: 
     111         
     112        { 
     113        'fields': ('first_name', 'last_name', 'address', 'city', 'state'), 
     114        } 
     115 
     116    To display multiple fields on the same line, wrap those fields in their own 
     117    tuple. In this example, the ``first_name`` and ``last_name`` fields will 
     118    display on the same line:: 
     119         
     120        { 
     121        'fields': (('first_name', 'last_name'), 'address', 'city', 'state'), 
     122        } 
    122123 
    123124``classes`` 
    124 ~~~~~~~~~~~ 
    125  
    126 A string containing extra CSS classes to apply to the fieldset. 
    127  
    128 Example:: 
    129  
    130     { 
    131     'classes': 'wide', 
    132     } 
    133  
    134 Apply multiple classes by separating them with spaces. Example:: 
    135  
    136     { 
    137     'classes': 'wide extrapretty', 
    138     } 
    139  
    140 Two useful classes defined by the default admin-site stylesheet are 
    141 ``collapse`` and ``wide``. Fieldsets with the ``collapse`` style will be 
    142 initially collapsed in the admin and replaced with a small "click to expand" 
    143 link. Fieldsets with the ``wide`` style will be given extra horizontal space. 
     125    A string containing extra CSS classes to apply to the fieldset. 
     126     
     127    Example:: 
     128         
     129        { 
     130        'classes': 'wide', 
     131        } 
     132 
     133    Apply multiple classes by separating them with spaces. Example:: 
     134         
     135        { 
     136        'classes': 'wide extrapretty', 
     137        } 
     138     
     139    Two useful classes defined by the default admin-site stylesheet are 
     140    ``collapse`` and ``wide``. Fieldsets with the ``collapse`` style will be 
     141    initially collapsed in the admin and replaced with a small "click to expand" 
     142    link. Fieldsets with the ``wide`` style will be given extra horizontal space. 
    144143 
    145144``description`` 
    146 ~~~~~~~~~~~~~~~ 
    147  
    148 A string of optional extra text to be displayed at the top of each fieldset, 
    149 under the heading of the fieldset. It's used verbatim, so you can use any HTML 
    150 and you must escape any special HTML characters (such as ampersands) yourself. 
     145    A string of optional extra text to be displayed at the top of each fieldset, 
     146    under the heading of the fieldset. It's used verbatim, so you can use any HTML 
     147    and you must escape any special HTML characters (such as ampersands) yourself. 
    151148 
    152149``list_display`` 
    153 ---------------- 
     150~~~~~~~~~~~~~~~~ 
    154151 
    155152Set ``list_display`` to control which fields are displayed on the change list 
     
    262259 
    263260``list_display_links`` 
    264 ---------------------- 
     261~~~~~~~~~~~~~~~~~~~~~~ 
    265262 
    266263Set ``list_display_links`` to control which fields in ``list_display`` should 
     
    289286 
    290287``list_filter`` 
    291 --------------- 
     288~~~~~~~~~~~~~~~ 
    292289 
    293290Set ``list_filter`` to activate filters in the right sidebar of the change list 
     
    310307 
    311308``list_per_page`` 
    312 ----------------- 
     309~~~~~~~~~~~~~~~~~ 
    313310 
    314311Set ``list_per_page`` to control how many items appear on each paginated admin 
     
    316313 
    317314``list_select_related`` 
    318 ----------------------- 
     315~~~~~~~~~~~~~~~~~~~~~~~ 
    319316 
    320317Set ``list_select_related`` to tell Django to use ``select_related()`` in 
     
    332329 
    333330``inlines`` 
    334 ----------- 
     331~~~~~~~~~~~ 
    335332 
    336333See ``InlineModelAdmin`` objects below. 
    337334 
    338335``ordering`` 
    339 ------------ 
     336~~~~~~~~~~~~ 
    340337 
    341338Set ``ordering`` to specify how objects on the admin change list page should be 
     
    346343 
    347344``radio_fields`` 
    348 ---------------- 
     345~~~~~~~~~~~~~~~~ 
    349346 
    350347By default, Django's admin uses a select-box interface (<select>) for 
     
    363360 
    364361``save_as`` 
    365 ----------- 
     362~~~~~~~~~~~ 
    366363 
    367364Set ``save_as`` to enable a "save as" feature on admin change forms. 
     
    377374 
    378375``save_on_top`` 
    379 --------------- 
     376~~~~~~~~~~~~~~~ 
    380377 
    381378Set ``save_on_top`` to add save buttons across the top of your admin change 
     
    388385 
    389386``search_fields`` 
    390 ----------------- 
     387~~~~~~~~~~~~~~~~~ 
    391388 
    392389Set ``search_fields`` to enable a search box on the admin change list page. 
     
    514511This controls the maximum number of forms to show in the inline. This doesn't 
    515512directly corrolate to the number of objects, but can if the value is small 
    516 enough. See `max_num in model formsets`_ for more information. 
     513enough. See `max_num in formsets`_ for more information. 
    517514 
    518515.. _max_num in formsets: ../modelforms/#limiting-the-number-of-objects-editable 
     
    561558 
    562559Hooking ``AdminSite`` instances into your URLconf 
    563 ================================================= 
     560------------------------------------------------- 
    564561 
    565562The last step in setting up the Django admin is to hook your ``AdminSite`` 
     
    602599separate versions of the admin site -- using the ``AdminSite`` instances 
    603600``myproject.admin.basic_site`` and ``myproject.admin.advanced_site``, 
    604 respectively. 
     601respectively:: 
    605602 
    606603    # urls.py