Fixed #13862 -- Added an ordering option to InlineModelAdmin and cleaned up documentation for it a bit. Thanks, Simon Meers, rasca and cogat.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14882 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2010-12-12 22:56:01 +00:00
parent 1e7bb904df
commit b3520da9ac
4 changed files with 97 additions and 23 deletions

View file

@ -180,7 +180,7 @@ subclass::
.. versionadded:: 1.2
``fields`` can contain values defined in
:attr:`ModelAdmin.readonly_fields` to be displayed as read-only.
:attr:`~ModelAdmin.readonly_fields` to be displayed as read-only.
* ``classes``
A list containing extra CSS classes to apply to the fieldset.
@ -504,8 +504,8 @@ subclass::
.. attribute:: ModelAdmin.ordering
Set ``ordering`` to specify how objects on the admin change list page
should be ordered. This should be a list or tuple in the same format as a
Set ``ordering`` to specify how lists of objects should be ordered in the
Django admin views. This should be a list or tuple in the same format as a
model's ``ordering`` parameter.
If this isn't provided, the Django admin will use the model's default
@ -1089,8 +1089,36 @@ information.
``InlineModelAdmin`` options
-----------------------------
The ``InlineModelAdmin`` class is a subclass of ``ModelAdmin`` so it inherits
all the same functionality as well as some of its own:
``InlineModelAdmin`` shares many of the same features as ``ModelAdmin``, and
adds some of its own (the shared features are actually defined in the
``BaseModelAdmin`` superclass). The shared features are:
- :attr:`~InlineModelAdmin.form`
- :attr:`~ModelAdmin.fieldsets`
- :attr:`~ModelAdmin.fields`
- :attr:`~ModelAdmin.exclude`
- :attr:`~ModelAdmin.filter_horizontal`
- :attr:`~ModelAdmin.filter_vertical`
- :attr:`~ModelAdmin.prepopulated_fields`
- :attr:`~ModelAdmin.radio_fields`
- :attr:`~InlineModelAdmin.raw_id_fields`
.. versionadded:: 1.1
- :meth:`~ModelAdmin.formfield_for_foreignkey`
- :meth:`~ModelAdmin.formfield_for_manytomany`
.. versionadded:: 1.2
- :attr:`~ModelAdmin.readonly_fields`
- :attr:`~ModelAdmin.formfield_overrides`
.. versionadded:: 1.3
- :attr:`~ModelAdmin.ordering`
- :meth:`~ModelAdmin.queryset`
The ``InlineModelAdmin`` class adds:
.. attribute:: InlineModelAdmin.model
@ -1118,7 +1146,6 @@ all the same functionality as well as some of its own:
.. attribute:: InlineModelAdmin.extra
This controls the number of extra forms the formset will display in
addition to the initial forms. See the
:doc:`formsets documentation </topics/forms/formsets>` for more