Use grappelli to add templates to the django admin background
- 2020-04-02 14:21:54
- OfStack
Grappelli is the most star django templating system on github
(link: http://django-grappelli.readthedocs.org/en/latest/quickstart.html#installation)
pip install django-grappelli
settings.py
INSTALLED_APPS = (
'grappelli',
'django.contrib.admin',
)
Add url item
urlpatterns = patterns('',
(r'^grappelli/', include('grappelli.urls')), # grappelli URLS
(r'^admin/', include(admin.site.urls)), # admin site
)
The official installation instructions let you define STATICFILES_FINDER, but as the default, ignore it
Define the template context processors
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages"
)
The default value of django1.7 has been added here for convenience.