Skip to main content

A Django admin theme with a horizontal, tabbed navigation bar

Project description

Django Admin Menu Theme

An alternative theme for the Django admin that has a horizontal navigation bar with drop down menus for your models. Fully themeable from settings.py.

screenshot

Installation

Install the package:

pip install django-admin-menu

Then add admin_menu to your INSTALLED_APPS setting, before django.contrib.admin (or it wont work). For example:

INSTALLED_APPS = [
    'admin_menu',
    'django.contrib.admin',
    ...
]

Settings

There are a couple of options you can adjust in your settings.py to influence the theme.

To adjust the logo, change:

ADMIN_LOGO = 'logo.png'

The logo is used in the top left of each page and on the login page.

You can adjust the order of the menu items with the MENU_WEIGHT setting:

MENU_WEIGHT = {
    'World': 20,
    'Auth': 4,
    'Sample': 5
}

Items with a higher weight will be pushed to the end of the menu. You don't have to fill in all the menu items, just the ones you would like to adjust the position of.

ModelAdmin Settings

There are a few settings on your ModelAdmin class to adjust the menu:

class MyAdmin(admin.ModelAdmin):
    menu_title = "Users"
    menu_group = "Staff"

will change the title for this model to Users and place it on a drop down titled Staff.

You can use the same menu_group on multiple ModelAdmin classes and they will be grouped on the same menu.

Screenshots

screenshot screenshot screenshot

Theming

To adjust the theme, you can add and edit these options in your project's settings.py file:

ADMIN_STYLE = {
    'primary-color': '#164B36',
    'secondary-color': '#092117',
    'tertiary-color': '#51B48E'
}

These variables are usually enough to add a brand flavour to the admin. There are other variables you can add, to change text colour etc. These are listed under Custom Theme.

Dark Theme

screenshot

Add to your settings.py:

ADMIN_STYLE = {
    'primary-color': '#2B3746',
    'secondary-color': '#354151',
    'tertiary-color': '#F2F9FC'
}

Django Theme

screenshot

Add to your settings.py:

ADMIN_STYLE = {
    'primary-color': '#164B36',
    'secondary-color': '#092117',
    'tertiary-color': '#51B48E'
}

Red Theme

screenshot

Add to your settings.py:

ADMIN_STYLE = {
    'primary-color': '#B42D33',
    'secondary-color': '#000000',
    'tertiary-color': '#333333'
}

Custom Themes

You can customise the theme however you like, using these available variables:

ADMIN_STYLE = {
    'background': 'white',
    'primary-color': '#205280',
    'primary-text': '#d6d5d2',
    'secondary-color': '#3B75AD',
    'secondary-text': 'white',
    'tertiary-color': '#F2F9FC',
    'tertiary-text': 'black',
    'breadcrumb-color': 'whitesmoke',
    'breadcrumb-text': 'black',
    'focus-color': '#eaeaea',
    'focus-text': '#666',
    'primary-button': '#26904A',
    'primary-button-text':' white',
    'secondary-button': '#999',
    'secondary-button-text': 'white',
    'link-color': '#333',
    'link-color-hover': 'lighten($link-color, 20%)',
    'logo-width': 'auto',
    'logo-height': '35px'
}

History

[1.0] - 2016-12-05

First release, works.

[1.1] - 2016-12-16

Added theming support.

[1.2] - 2020-04-06

  • Added support for Django 3.0+.
  • Made the ADMIN_LOGO setting optional.
  • Allowed adjusting admin logo size with logo-width and logo-height style settings.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-admin-menu-1.2.1.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

django_admin_menu-1.2.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file django-admin-menu-1.2.1.tar.gz.

File metadata

  • Download URL: django-admin-menu-1.2.1.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for django-admin-menu-1.2.1.tar.gz
Algorithm Hash digest
SHA256 c759d1e31e4095ebb98c73c4585747856115b0f694906e49281065f6d08e95b4
MD5 a2c5ec7d88dbee07d52a6bd34137cdb5
BLAKE2b-256 4e331fc587ca2f187585dbc3ae2017531c2ad167c86c0976447d77cd3010943b

See more details on using hashes here.

Provenance

File details

Details for the file django_admin_menu-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: django_admin_menu-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for django_admin_menu-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 82faa9251048d12ff60a7843500ee41ed80153a1da5f75c74558991a66885d30
MD5 90ec4fc1e05427bf8eb2e11f33b7f3f8
BLAKE2b-256 88fdfcfa3fc0a5d0d1ba61d1023ce5b2f23813f14804ad39a1784e486d41eb7a

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page