| 1 | Admin revamp project. |
| 2 | |
| 3 | 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: |
| 4 | - extend every pages of the admin in an arbitrary fashion without having to rely on Javascript hacks |
| 5 | - make it possible to add views easily |
| 6 | - Refresh the design and make it responsive |
| 7 | |
| 8 | == Current admin limitations == |
| 9 | |
| 10 | Current methods to customize the pages of the admin are the following: |
| 11 | |
| 12 | - 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 |
| 13 | - 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 ? |
| 14 | - Insert Javascript, this is the most flexible way to extend the admin, it's hacky and promotes creation of code that might not be accessible. |
| 15 | - 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. |
| 16 | - Monkeypatching: ''I have no example of that but I know it's used in production on some sites'' |
| 17 | - 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. |
| 18 | - ... |
| 19 | |
| 20 | == Usecases == |
| 21 | |
| 22 | - Create a dashboard |
| 23 | - Manipulate objects which are not model instances ([http://code.larlet.fr/django-roa/wiki/Home django-roa] [https://github.com/liberation/django-sneak django-sneak], [https://github.com/liberation/django-admincommand django-admin-commands]) |
| 24 | - Read-only objects |
| 25 | - Going beyond what is offered by current ModelAdmin in terms of form layout/experience ([https://github.com/liberation/django-admin-tabs django-admin-tabs]) |
| 26 | - Customize user experience based on cookie |
| 27 | - Target other devices ([https://github.com/jezdez/django-mobileadmin django-mobileadmin], maybe something more up-to-date ?) |
| 28 | - Integrate frontend features/experience in the backend |
| 29 | - Add links to other views in the admin index page |
| 30 | |
| 31 | == Bugs, Feature requests == |
| 32 | |
| 33 | [https://code.djangoproject.com/query?status=assigned&status=new&status=reopened&component=contrib.admin&col=id&col=summary&col=status&col=owner&col=type&col=component&order=priority Trac query] |
| 34 | |
| 35 | == Features == |
| 36 | |
| 37 | High: |
| 38 | - Same features as current admin |
| 39 | - Responsive |
| 40 | - Use class-based-views throughout |
| 41 | - Clear patterns to extend the admin |
| 42 | - ... |
| 43 | |
| 44 | Low: |
| 45 | - Reusable components across projects and within the same project |
| 46 | - ... |
| 47 | |
| 48 | Spotlight of current feature of the admin: |
| 49 | |
| 50 | - 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. |
| 51 | |
| 52 | == Examples of Admin Extension in the Wild == |
| 53 | |
| 54 | In alphabetical order: |
| 55 | |
| 56 | * django-admin-tools (http://pypi.python.org/pypi/django-admin-tools/0.4.1) |
| 57 | - a full featured and customizable dashboard |
| 58 | - a customizable menu bar |
| 59 | - tools to make admin theming easier (''what does it mean ?'') |
| 60 | * [http://pypi.python.org/pypi/django-adminplus django-adminplus] |
| 61 | * [https://github.com/django-djam/django-djam Django-djam] |
| 62 | * Grappelli (http://www.grappelliproject.com/) |
| 63 | - It's a skin |
| 64 | * [https://github.com/divio/djangocms-admin-style djangocms-admin-style] |
| 65 | * [https://github.com/Django-Composite/django-composite-admin django-composite-admin] |
| 66 | * [https://github.com/disqus/nexus Nexus] |
| 67 | * |
| 68 | * |
| 69 | |
| 70 | |
| 71 | Built on top of admin-tools: |
| 72 | * django-admintools-bootstrap (https://bitbucket.org/salvator/django-admintools-bootstrap) |
| 73 | * pops (https://github.com/tswicegood/pops -- fork/near rewrite of above) |
| 74 | * … |
| 75 | |
| 76 | Simple Bootstrap Themes: |
| 77 | * https://github.com/michaelhelmick/django-bootstrap-admin |
| 78 | * https://github.com/gkuhn1/django-admin-templates-twitter-bootstrap |
| 79 | * https://github.com/riccardo-forina/django-admin-bootstrapped |
| 80 | * https://github.com/aobo711/bootstrap-django-admin |
| 81 | * … |
| 82 | |
| 83 | |
| 84 | == Pros == |
| 85 | |
| 86 | - No more hacks: Offers a clear canvas to extend the admin |
| 87 | - ... |
| 88 | |
| 89 | == Cons == |
| 90 | |
| 91 | - Backward incompatible |
| 92 | - ... |
| 93 | |
| 94 | == Comments == |
| 95 | |
| 96 | - 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'' |
| 97 | - 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'' |
| 98 | - A refresh of the UI can be done in a separate project and land in master sooner, I think, same goes for [https://groups.google.com/forum/?fromgroups=#!topic/django-developers/aj1VEkA3FwI improving current javascript facility]. ''–Amirouche'' |