Skip to main content
==============================================================================
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

# You have to set the name of the parent foreign key yourself:
fk_name = 'parent'

# 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``.


Metadata

Release files for django-admin-ordering 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-admin-ordering 0.8.1
File Size Uploaded
django-admin-ordering-0.8.1.tar.gz 17.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-admin-ordering 0.8.1
File Interpreter ABI Platform
django_admin_ordering-0.8.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 36.7 kB

Release files / django-admin-ordering-0.8.1.tar.gz

Download URL django-admin-ordering-0.8.1.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e3b73959c2c2f25d1a8b4fb57dea7870295c6cfd318dd0de9e3ed96943b9e6df
BLAKE2b-256 checksum
How to use checksums
5fbd1ab7730de151e2a8d387cff5bc1f7fdca7789f6522a3ece5efdb776481bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_admin_ordering-0.8.1-py2.py3-none-any.whl

Download URL django_admin_ordering-0.8.1-py2.py3-none-any.whl
Size 19.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
47534423a85ac800a01337d9690e6dd7cbf04cf23cbc954da695b5d9477701a3
BLAKE2b-256 checksum
How to use checksums
7b9ea3444acde71c317be129d60641ef2faadfe7ace93e951dd45e7af0fb78e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.21.0

2 release files

0.20.0

2 release files

0.19.1

2 release files

0.19.0

2 release files

0.18.2

2 release files

0.18.1

2 release files

0.18.0

2 release files

0.16.1

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.2

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.9.0

2 release files

This release

0.8.1 This release

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page