Easy way to order and rename models in the django admin page.
- Ordering Models inside Categories (ex: model
truck
before modelcar
) - Ordering Categories (ex: app
vehicules
before apporders
) - Changing the Model Label (ex: renaming the
CarPartType
model toTypes of Car parts
)
(not published yet)
Install with pip
pip install django-admin-reorder
Then in settings.py
INSTALLED_APPS = (
...
'admin-reorder',
...
)
Renaming a model :
@admin.register(MyExampleModel)
class MyExampleModelAdmin(admin.ModelAdmin):
reorder_label = "Changed the model name"
list_display = ('one', 'two')
Ordering a model in a category :
@admin.register(MyExampleModel)
class MyExampleModelAdmin(admin.ModelAdmin):
reorder_label = "Changed the model name"
reorder_priority = 10
list_display = ('one', 'two')
Works on Django:
- 5.0
- 4.2
These are the only versions i tested, might work on more.
- Support listing a model more than once
When searching alternatives to django-modeladmin-reorder, i found this thread that gave me the idea of changing model names and order just by adding the data to the modeladmin.
The admin.AdminSite.get_app_list method is replaced for custom behaviour.