Django-admin-bootstrap

来自linux中国网wiki
Evan讨论 | 贡献2019年10月14日 (一) 13:48的版本 (导入1个版本)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳到导航 跳到搜索

bootstrap-admin

1 install

pip install bootstrap-admin

2 config

vi  mysite/settings.py
#And don't forget to add bootstrap_admin in INSTALLED_APPS before the django.contrib.admin.

INSTALLED_APPS = (
    # ...
    'bootstrap_admin', # always before django.contrib.admin
    'django.contrib.admin',
    # ...
)

from django.conf import global_settings
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            # insert your TEMPLATE_DIRS here
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                # Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
                # list if you haven't customized them:
                'django.contrib.auth.context_processors.auth',
                'django.template.context_processors.debug',
                'django.template.context_processors.i18n',
                'django.template.context_processors.media',
                'django.template.context_processors.static',
                'django.template.context_processors.tz',
                'django.contrib.messages.context_processors.messages',
                'django.template.context_processors.request'
            ]
        },
    },
]

BOOTSTRAP_ADMIN_SIDEBAR_MENU = True

参考

https://github.com/django-admin-bootstrap/django-admin-bootstrap