Snippet List
I have been wrestling with custom app labels and have come to the conclusion that this is the easiest workaround for the problem. Since I name most of my apps as Foo_Bar this makes them look a lot nicer. I just apply the filter to whatever app label and it fixes it.
If you need a more complex replacement, you could just have an if statement that looks for the full app label and replaces it with whatever you want.
- template
- filter
- app-label
- app-display
This allows you to order the models on the index page of the administration site in a custom way.
This modification goes in the index method of django.contrib.admin.sites.AdminSite. I personally monkey patched it in where my models are loaded and registered with the admin site. Be careful that if you add new models you update the sorting dictionary, else you will get a key error. If no sorting is defined for an app, it will default to alphabetical order.
Note that you'll probably want to also insert this into the app_index function as well.
---
If you like my work, please check out my employer's site at 829llc.com
- Dan
- models
- admin
- sort
- sorting
- app-models
programmerDan has posted 2 snippets.