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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-admin-ordering-0.8.1.tar.gz | 17.6 kB | Without provenance | Details for django-admin-ordering-0.8.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_admin_ordering-0.8.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for django_admin_ordering-0.8.1-py2.py3-none-any.whl |
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 |
Security for django-admin-ordering 0.8.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.