Changeset 7683
- Timestamp:
- 06/17/08 17:00:48 (5 months ago)
- Files:
-
- django/branches/newforms-admin/docs/admin.txt (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/newforms-admin/docs/admin.txt
r7626 r7683 47 47 admin.site.register(Author, AuthorAdmin) 48 48 49 ``ModelAdmin`` Options 50 ---------------------- 51 49 52 The ``ModelAdmin`` is very flexible. It has several options for dealing with 50 53 customizing the interface. All options are defined on the ``ModelAdmin`` … … 55 58 56 59 ``date_hierarchy`` 57 ------------------ 60 ~~~~~~~~~~~~~~~~~~ 58 61 59 62 Set ``date_hierarchy`` to the name of a ``DateField`` or ``DateTimeField`` in … … 66 69 67 70 ``fieldsets`` 68 ------------- 71 ~~~~~~~~~~~~~ 69 72 70 73 Set ``fieldsets`` to control the layout of admin "add" and "change" pages. … … 103 106 104 107 ``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 } 122 123 123 124 ``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. 144 143 145 144 ``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. 151 148 152 149 ``list_display`` 153 ---------------- 150 ~~~~~~~~~~~~~~~~ 154 151 155 152 Set ``list_display`` to control which fields are displayed on the change list … … 262 259 263 260 ``list_display_links`` 264 ---------------------- 261 ~~~~~~~~~~~~~~~~~~~~~~ 265 262 266 263 Set ``list_display_links`` to control which fields in ``list_display`` should … … 289 286 290 287 ``list_filter`` 291 --------------- 288 ~~~~~~~~~~~~~~~ 292 289 293 290 Set ``list_filter`` to activate filters in the right sidebar of the change list … … 310 307 311 308 ``list_per_page`` 312 ----------------- 309 ~~~~~~~~~~~~~~~~~ 313 310 314 311 Set ``list_per_page`` to control how many items appear on each paginated admin … … 316 313 317 314 ``list_select_related`` 318 ----------------------- 315 ~~~~~~~~~~~~~~~~~~~~~~~ 319 316 320 317 Set ``list_select_related`` to tell Django to use ``select_related()`` in … … 332 329 333 330 ``inlines`` 334 ----------- 331 ~~~~~~~~~~~ 335 332 336 333 See ``InlineModelAdmin`` objects below. 337 334 338 335 ``ordering`` 339 ------------ 336 ~~~~~~~~~~~~ 340 337 341 338 Set ``ordering`` to specify how objects on the admin change list page should be … … 346 343 347 344 ``radio_fields`` 348 ---------------- 345 ~~~~~~~~~~~~~~~~ 349 346 350 347 By default, Django's admin uses a select-box interface (<select>) for … … 363 360 364 361 ``save_as`` 365 ----------- 362 ~~~~~~~~~~~ 366 363 367 364 Set ``save_as`` to enable a "save as" feature on admin change forms. … … 377 374 378 375 ``save_on_top`` 379 --------------- 376 ~~~~~~~~~~~~~~~ 380 377 381 378 Set ``save_on_top`` to add save buttons across the top of your admin change … … 388 385 389 386 ``search_fields`` 390 ----------------- 387 ~~~~~~~~~~~~~~~~~ 391 388 392 389 Set ``search_fields`` to enable a search box on the admin change list page. … … 514 511 This controls the maximum number of forms to show in the inline. This doesn't 515 512 directly corrolate to the number of objects, but can if the value is small 516 enough. See `max_num in modelformsets`_ for more information.513 enough. See `max_num in formsets`_ for more information. 517 514 518 515 .. _max_num in formsets: ../modelforms/#limiting-the-number-of-objects-editable … … 561 558 562 559 Hooking ``AdminSite`` instances into your URLconf 563 ================================================= 560 ------------------------------------------------- 564 561 565 562 The last step in setting up the Django admin is to hook your ``AdminSite`` … … 602 599 separate versions of the admin site -- using the ``AdminSite`` instances 603 600 ``myproject.admin.basic_site`` and ``myproject.admin.advanced_site``, 604 respectively .601 respectively:: 605 602 606 603 # urls.py
