Custom ordering for models in the admin app.
Project description
django-admin-model-list-order
Custom ordering for models in the admin app. You can define your order by admin_order
in ModelAdmin
Install
Install django-admin-model-list-order:
.. code-block:: bash
pip install django-admin-model-list-order
Configuration
- Add
admin_model_list_order
toINSTALLED_APPS
:
.. code-block:: bash
INSTALLED_APPS = (
...
'admin_model_list_order',
...
)
- Add the
AdminModelListOrder
toMIDDLEWARE_CLASSES
:
.. code-block:: bash
MIDDLEWARE_CLASSES = (
...
'admin_model_list_order.middleware.AdminModelListOrder',
...
)
- Add the setting
ADMIN_MODEL_DEFAULT_PRIORITY
to your settings.py, It will add default priority 100 to modelAdmin:
.. code-block:: bash
ADMIN_MODEL_DEFAULT_PRIORITY = 100
- Add the setting
admin_order
to your admin.py:
.. code-block:: bash
class YourModelAdmin(admin.ModelAdmin):
model = YourModel
admin_order = 1
Example
.. code-block:: bash
class Model1(admin.ModelAdmin):
model = Model 1
admin_order = 1
.. code-block:: bash
class Model2(admin.ModelAdmin):
model = Model 2
admin_order = 2
It will come in app in this order
Model 1
Model 2
History
0.0.1 (2021-07-27) ++++++++++++++++++
- First release on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-admin-model-list-order-0.0.4.tar.gz
.
File metadata
- Download URL: django-admin-model-list-order-0.0.4.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d2d0123b3d81d92ff2b7e9f243056518b74eb8e2500ca4c131dff828d758573 |
|
MD5 | f68a5fa5faf7c89696d2eec3b2f972eb |
|
BLAKE2b-256 | e3981e1540646207fded7d6794c6e49bd8945206f6c5d027976664c5007e815f |