|Version 6 (modified by abki, 19 months ago) (diff)|
Admin revamp project.
What we propose here is a revamp of the the admin app looking for minimal work to customize the admin, striving for reusability and maintenability while still making it possible to:
- make it possible to add views easily
- Refresh the design and make it responsive
Current admin limitations
Current methods to customize the pages of the admin are the following:
- most common way: Override ModelAdmin or Admin class methods, inject needed variables in template context and then override the templates: this can be made simpler, overriding templates is not considered future proof and can be made simpler
- There are hooks to insert custom code (filter spec, admin actions) but it's predefined, not flexible and bound to features already defined in the admin. What if one wants a custom sidebar that fills the form dynamically from generated list of templates ?
- Overrindg templates: this is tricky since and has the same limitations as above lake of maintenability, readability and reusability and can make an extensive (anti-pattern) use of templatetags to get things done.
- Monkeypatching: I have no example of that but I know it's used in production on some sites
Following limitations are from my own and might not reflect reality don't hesitate to comment or strip if it's not appropriate:
- In a context where you have several admin sites or experiences because of different user permissions or settings, templates are the only reusable part. You can create functions to encapsulate some functionality but there is no canvas for that and can become a bit messy with a big file named like admin_views_utils.py.
- Since urls are computed for every requests, it makes the admin impractical for user facing applications.
- Create a dashboard
- Manipulate objects which are not model instances (django-roa django-sneak, django-admin-commands)
- Read-only objects
- Going beyond what is offered by current ModelAdmin in terms of form layout/experience (django-admin-tabs)
- Customize user experience based on cookie
- Target other devices (django-mobileadmin, maybe something more up-to-date ?)
- Integrate frontend features/experience in the backend
- Add links to other views in the admin index page
Bugs, Feature requests
- Same features as current admin
- Use class-based-views throughout
- Clear patterns to extend the admin
- Reusable components across projects and within the same project
Spotlight of current feature of the admin
- The new admin app should, like the current admin app, allow the user to enable full secure (permission-based) CRUD in one line of code.
Examples of Admin Extension in the Wild
In alphabetical order:
- django-admin-tools (http://pypi.python.org/pypi/django-admin-tools/0.4.1)
- a full featured and customizable dashboard
- a customizable menu bar
- tools to make admin theming easier (what does it mean ?)
- Grappelli (http://www.grappelliproject.com/)
- It's a skin
Built on top of admin-tools:
- django-admintools-bootstrap (https://bitbucket.org/salvator/django-admintools-bootstrap)
- pops (https://github.com/tswicegood/pops -- fork/near rewrite of above)
Simple Bootstrap Themes:
- No more hacks: Offers a clear canvas to extend the admin
- More reusable components for Django
- No more monkey-patching
- Backward incompatible
- More layer in view stack
Solution inspired from PHP-Nuke in a compound word it's a compositing widget framework.
- Hydro this is an application framework with all of what is needed to create an application using pages/widgets classes
- HydroAdmin this is an example app of the Hydro application that use the compositing widget framework to build a backend equivalent in feature to current admin
- Instead of proposing a specific solution, let's focus on identifying the issues that the current admin has without the editorial content. For example "no more monkey patching" as a pro without an actual example of functionality that can not be done without monkey patching the admin is baseless. –Travis Swicegood
- I reworked the page to try to make it more obvious that it's not Hydro the next admin and main topic but that the Hydro application is just an idea with code. –Amirouche