Orderable change lists and inlines done right^Wsimple
Project description
==============================================================================
django-admin-ordering -- Orderable change lists and inlines done right^Wsimple
==============================================================================
.. image:: https://travis-ci.org/matthiask/django-admin-ordering.svg?branch=master
:target: https://travis-ci.org/matthiask/django-admin-ordering
Please refer to the Travis CI build linked above for the currently
supported combinations of Python and Django.
Installation
============
``pip install django-admin-ordering``, and add ``admin_ordering`` to
``INSTALLED_APPS``.
Usage
=====
First, you need a model ordered by an integer field.
Orderable change lists
~~~~~~~~~~~~~~~~~~~~~~
::
from admin_ordering.admin import OrderableAdmin
@admin.register(MyModel)
class MyModelAdmin(OrderableAdmin, admin.ModelAdmin):
# The field used for ordering. Prepend a minus for reverse
# ordering: '-order'
ordering_field = 'order'
# You may optionally hide the ordering field in the changelist:
# ordering_field_hide_input = False
# The ordering field must be included both in list_display and
# list_editable:
list_display = ('name', 'order', )
list_editable = ('order', )
Orderable inlines
~~~~~~~~~~~~~~~~
::
from admin_ordering.admin import OrderableAdmin
class MyModelTabularInline(OrderableAdmin, admin.TabularInline):
model = MyModel
# Same as above; '-order' is also allowed here:
ordering_field = 'order'
# ordering_field_hide_input = False
``OrderableAdmin`` comes with a default of ``extra = 0`` (no extra
empty inlines shown by default). It is strongly recommended to leave the
changed default as-is, because otherwise you'll end up with invalid
inlines just because you wanted to change the ordering.
Limitations
===========
- Starting with Django 1.9 newly created inlines are automatically assigned
a good ordering value. Earlier versions do not support the required
``formset:added`` signal.
- ``OrderableAdmin`` can be used both for inlines and parents, but this
also means that you cannot register a model directly with
``OrderableAdmin``.
django-admin-ordering -- Orderable change lists and inlines done right^Wsimple
==============================================================================
.. image:: https://travis-ci.org/matthiask/django-admin-ordering.svg?branch=master
:target: https://travis-ci.org/matthiask/django-admin-ordering
Please refer to the Travis CI build linked above for the currently
supported combinations of Python and Django.
Installation
============
``pip install django-admin-ordering``, and add ``admin_ordering`` to
``INSTALLED_APPS``.
Usage
=====
First, you need a model ordered by an integer field.
Orderable change lists
~~~~~~~~~~~~~~~~~~~~~~
::
from admin_ordering.admin import OrderableAdmin
@admin.register(MyModel)
class MyModelAdmin(OrderableAdmin, admin.ModelAdmin):
# The field used for ordering. Prepend a minus for reverse
# ordering: '-order'
ordering_field = 'order'
# You may optionally hide the ordering field in the changelist:
# ordering_field_hide_input = False
# The ordering field must be included both in list_display and
# list_editable:
list_display = ('name', 'order', )
list_editable = ('order', )
Orderable inlines
~~~~~~~~~~~~~~~~
::
from admin_ordering.admin import OrderableAdmin
class MyModelTabularInline(OrderableAdmin, admin.TabularInline):
model = MyModel
# Same as above; '-order' is also allowed here:
ordering_field = 'order'
# ordering_field_hide_input = False
``OrderableAdmin`` comes with a default of ``extra = 0`` (no extra
empty inlines shown by default). It is strongly recommended to leave the
changed default as-is, because otherwise you'll end up with invalid
inlines just because you wanted to change the ordering.
Limitations
===========
- Starting with Django 1.9 newly created inlines are automatically assigned
a good ordering value. Earlier versions do not support the required
``formset:added`` signal.
- ``OrderableAdmin`` can be used both for inlines and parents, but this
also means that you cannot register a model directly with
``OrderableAdmin``.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for django-admin-ordering-0.11.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e1f9d61d94fe3872f06a304471b3fe6bb01dde3bcff4a7e2f9f2e8b1b84ea4e |
|
MD5 | ed10b02e09fbfbcc3fe8b126c3042833 |
|
BLAKE2b-256 | e86b00e2d6a80fbd417913007f103388b59457d8e15e50b402b368ec270bc6cd |
Close
Hashes for django_admin_ordering-0.11.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6ab1acc75dd9c9aeab73f0ddeb23b1bcc4032f1c113081f0791026efb5943e7 |
|
MD5 | 8326e0464dbfc44a9a0181960c916c02 |
|
BLAKE2b-256 | c78a78618524787162715383ab2f66d0a6e309849e0183ac1347644a32484e42 |