Add simple and pretty shortcuts to the django admin homepage.
Project description
What is this?
It’s a simple dashboard app that adds shortcuts to your django admin homepage. The keyword here is SIMPLE!
Why does it exist?
Because some people noted that it’s sometimes hard to find the app you are looking for on the admin homepage.
“So why don’t we customize the admin site a bit?”
“Nah, I don’t want to go through all the hassle of editing templates or setting up a complex dashboard app …”
Well, good thing django-admin-shortcuts is here, because it only takes five minutes of your time to go from the old dreadfully boring admin to the marvelous engineering excellence that is this app.
How do i use it?
pip install django-admin-shortcuts
add 'admin_shortcuts' to your INSTALLED_APPS, just before 'admin' <– IMPORTANT
add ADMIN_SHORTCUTS to your settings
For example:
ADMIN_SHORTCUTS = [ { 'title': _('Shop'), 'shortcuts': [ { 'url_name': 'admin:shop_order_changelist', 'title': _('Products'), 'count_new': 'project.utils.count_new_orders', }, ] }, ]
- Where …
url_name is a name that will be resolved using django’s reverse url method (see https://docs.djangoproject.com/en/1.4/ref/contrib/admin/#reversing-admin-urls)
optional url is a direct link that will override url_name
optional title is the title of the shortcut
optional count and count_new are paths to a function inside your project that returns something interesting (like a count of all products or a count of all pending orders)
optional open_new_window sets whether the link should open in a new window (default is False)
optional class is the CSS class to be added to the anchor element (if you don’t specify one, magical ponies will do it for you)
profit!!
optionally, also add ADMIN_SHORTCUTS_SETTINGS to your settings
ADMIN_SHORTCUTS_SETTINGS = { 'hide_app_list': False, 'open_new_window': False, }
- Where …
optional hide_app_list collapses the app list
optional open_new_window makes all shortcuts open in a new window
What are the settings used in the pretty image above?
ADMIN_SHORTCUTS = [ { 'shortcuts': [ { 'url': '/', 'open_new_window': True, }, { 'url_name': 'admin:cms_page_changelist', 'title': _('Pages'), }, { 'url_name': 'admin:filer_folder_changelist', 'title': _('Files'), }, { 'url_name': 'admin:auth_user_changelist', 'title': _('Users'), }, { 'url_name': 'admin:contactform_contactformsubmission_changelist', 'title': _('Contact forms'), 'count_new': 'project.utils.count_new_contactforms', }, ] }, { 'title': _('Shop'), 'shortcuts': [ { 'url_name': 'admin:shop_product_changelist', 'title': _('Products'), 'count': 'project.utils.count_products', }, { 'url_name': 'admin:shop_category_changelist', 'title': _('Categories'), }, { 'url_name': 'admin:shop_order_changelist', 'title': _('Orders'), 'count_new': 'project.utils.count_new_orders', }, ] }, ] ADMIN_SHORTCUTS_SETTINGS = { 'hide_app_list': True, 'open_new_window': False, }
I want to change how it looks
just overwrite the templates/admin_shortcuts/base.css template
Notes
Icons grabbed from Pixeden.com
Project details
Release history Release notifications | RSS feed
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-shortcuts-1.0.tar.gz
.
File metadata
- Download URL: django-admin-shortcuts-1.0.tar.gz
- Upload date:
- Size: 27.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fc5ac30ceff0c6994b1e8e701e232cf962ddb80c1b2a223b77079913a005bc5 |
|
MD5 | 1c3c1d439375a8c71a659fad724064d9 |
|
BLAKE2b-256 | 4e7d0aa2a7e594e7dfae79e494329fd1424309eb5303bcb54e013620fc420406 |