Home

Awesome

Django Admin Shortcuts

image

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?

  1. pip install django-admin-shortcuts

  2. add 'admin_shortcuts' to your INSTALLED_APPS, just before 'django.contrib.admin' <-- IMPORTANT

  3. add ADMIN_SHORTCUTS to your settings

    For example:

ADMIN_SHORTCUTS = [
    {
        'title': 'Authentication',
        'shortcuts': [
            {
                'title': 'Groups',
                'url_name': 'admin:auth_group_changelist',
                               'has_perms': ['example.change_group', 'example.delete_group'],
            },
            {
                'title': 'Add user',
                'url_name': 'admin:auth_user_add',
                'test_func': 'example.utils.has_perms_to_users',
            },
        ]
    },
]

Where ...

  1. profit!!

  2. optionally, also add ADMIN_SHORTCUTS_SETTINGS to your settings

ADMIN_SHORTCUTS_SETTINGS = {
    'open_new_window': False,
}

Where ...

What are the settings used in the pretty image above?

ADMIN_SHORTCUTS = [
    {
        'shortcuts': [
            {
                'url': '/',
                'open_new_window': True,
            },
            {
                'url_name': 'admin:logout',
            },
            {
                'title': 'Users',
                'url_name': 'admin:auth_user_changelist',
                'count': 'example.utils.count_users',
            },
            {
                'title': 'Groups',
                'url_name': 'admin:auth_group_changelist',
                'count': 'example.utils.count_groups',
                'has_perms': ['example.change_group', 'example.delete_group'],
            },
            {
                'title': 'Add user',
                'url_name': 'admin:auth_user_add',
                'test_func': 'example.utils.has_perms_to_users',
                'has_perms': 'example.utils.has_perms_to_users',
            },
        ]
    },
    {
        'title': 'CMS',
        'shortcuts': [
            {
                'title': 'Pages',
                'url_name': 'admin:index',
            },
            {
                'title': 'Files',
                'url_name': 'admin:index',
                'icon': '❤️'
            },
            {
                'title': 'Contact forms',
                'url_name': 'admin:index',
                'count_new': '3',
            },
            {
                'title': 'Products',
                'url_name': 'admin:index',
            },
            {
                'title': 'Orders',
                'url_name': 'admin:index',
                'count_new': '12',
            },
        ]
    },
]
ADMIN_SHORTCUTS_SETTINGS = {
    'open_new_window': False,
}

I want to change how stuff looks