Changes between Version 15 and Version 16 of NewAdminChanges


Ignore:
Timestamp:
10/30/2005 11:52:13 AM (10 years ago)
Author:
rjwittams
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NewAdminChanges

    v15 v16  
    192192== Admin converted to separate templates ==
    193193
    194 The admin is now rendered using separate templates. These can be overloaded, meaning the admin is a bit easily customizable.
    195 Inline editing can use a custom template, reather than using edit_inline=meta.TABULAR or meta.SOURCE, just use a path to a template, eg edit_inline="edit_inline_horizontal".
    196 
    197  This does require knowing the contents of the context for that template which is undocumented. Also this will probably change to a class to allow more flexibility, eg processing for style/grouping logic etc.
     194The admin is now rendered using separate templates. These can be overloaded, meaning the admin is a bit more easily customizable.
     195
     196An example is change forms - these are the forms used to modify and add objects in the admin. The templates are selected in the following order :
     197
     198admin/<app_label>/<object_name>/change_form
     199admin/<app_label>/change_form
     200admin/change_form
     201
     202So it is possible to change the form just for one kind of object.
     203This makes it possible to add in extra information or change existing blocks eg branding.
     204
     205So if we take the polls app as an example, we may want to customise the admin page just for the polls object.
     206
     207We create a file {{{admin/polls/polls/change_form.html}}} in our apps template directory, with the contents:
     208{{{
     209
     210{%extends "admin/change_form" %}
     211
     212{% block branding %} Customised title {% endblock %}
     213{% block after_field_sets %} Some interesting information after the field sets  {% endblock %}
     214
     215}}}
     216
     217This works using normal template inheritance, so make sure you inherit from the right thing.
     218
     219In the change forms, the following blocks are available for custom overriding:
     220
     221branding - included from "admin/base"
     222form_top - at the top of the form after the title.
     223after_field_sets - after standard field sets, before the related objects
     224after_related_objects - after edit_inline objects
     225
     226
     227Inline editing can be customised. rather than using edit_inline=meta.TABULAR or meta.SOURCE, you can define a custom inline editing mode. This is done by subclassing BoundRelatedObject, and using that class. eg edit_inline=HorizontalScroller.
Back to Top