Orderable change lists and inlines done right^Wsimple
Project description
Steps
Have a model ordered by an integer field.
Install django-admin-ordering and add admin_ordering to INSTALLED_APPS.
Inherit admin_ordering.admin.OrderableAdmin in your own ModelAdmin and StackedInline/TabularInline subclasses and set ordering_field to a field name of the ordering integer field. Negative ordering (e.g. for a priority field) is also supported, simply prepend a minus sign to the ordering field. Also set fk_name to the parent foreign key if you want orderable inlines. Do absolutely nothing if you want an orderable changelist.
Ensure that the field is displayed in the change form if you define fieldsets yourself, or is contained in list_editable for change lists.
Report any bugs you find (patches welcome)!
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
File details
Details for the file django-admin-ordering-0.7.1.tar.gz
.
File metadata
- Download URL: django-admin-ordering-0.7.1.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89108171829448dc72400d5bb14e019809f3e49b8d79cbe6b0114d97e78a1aac |
|
MD5 | f68b341ba364617a9206ff2e927d5bf3 |
|
BLAKE2b-256 | af6f4a2081e8f7096ebe145eba8c8c51751ed729a96132281fc5cc54ba83f69d |
File details
Details for the file django_admin_ordering-0.7.1-py2.py3-none-any.whl
.
File metadata
- Download URL: django_admin_ordering-0.7.1-py2.py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5f4bfe99a594ef937de18447ad296b36dd2cd07af1fa09cbdab20de85953e91 |
|
MD5 | 6c552b9a1f7cabe1430680a0163af940 |
|
BLAKE2b-256 | 07fe0af842f3c6fc7aa364920cd542433fa346a6ab05e6c77a3c7fcab5be2c90 |