Configuration¶
Templates¶
You must extend base_site.html
template to customize footer links, copyright text or to add extra JS/CSS files. Example file is available on github.
Copy customized base_site.html
template file to your project’s main application templates/admin/
directory and un-comment and edit the blocks you would like to extend.
Alternatively you can copy base_site.html
to any of template directories, which are defined in TEMPLATE_DIRS
setting (if any). By default Django looks in every registered application templates/
dir.
In the same way you can override any of Django Suit admin templates. More about customizing project’s templates, you can read in Django Admin Tutorial
Customization¶
You can customize Django Suit behaviour by adding SUIT_CONFIG
configuration variable to your Django project settings.py
file.
- SUIT_CONFIG = {
- ‘PARAM’: VALUE, ‘PARAM2’: VALUE2 …
}
Default values are the ones specified in examples.
Full example¶
Configuration sample you can use as a start:
# Django Suit configuration example
SUIT_CONFIG = {
# header
# 'ADMIN_NAME': 'Django Suit',
# 'HEADER_DATE_FORMAT': 'l, j. F Y',
# 'HEADER_TIME_FORMAT': 'H:i',
# forms
# 'SHOW_REQUIRED_ASTERISK': True, # Default True
# 'CONFIRM_UNSAVED_CHANGES': True, # Default True
# menu
# 'SEARCH_URL': '/admin/auth/user/',
# 'MENU_ICONS': {
# 'sites': 'icon-leaf',
# 'auth': 'icon-lock',
# },
# 'MENU_OPEN_FIRST_CHILD': True, # Default True
# 'MENU_EXCLUDE': ('auth.group',),
# 'MENU': (
# 'sites',
# {'app': 'auth', 'icon':'icon-lock', 'models': ('user', 'group')},
# {'label': 'Settings', 'icon':'icon-cog', 'models': ('auth.user', 'auth.group')},
# {'label': 'Support', 'icon':'icon-question-sign', 'url': '/support/'},
# ),
# misc
# 'LIST_PER_PAGE': 15
}
Header¶
Header related parameters
ADMIN_NAME¶
Admin name that will appear in header <title> tags and in footer:
SUIT_CONFIG = {
'ADMIN_NAME': 'Django Suit'
}
HEADER_DATE_FORMAT¶
HEADER_TIME_FORMAT¶
Header date and time formats. Formatting according to Django date templatefilter format. Default: as specified in example:
SUIT_CONFIG = {
'HEADER_DATE_FORMAT': 'l, j. F Y', # Saturday, 16th March 2013
'HEADER_TIME_FORMAT': 'H:i', # 18:42
}
Forms¶
SHOW_REQUIRED_ASTERISK¶
Automatically adds asterisk symbol *
to the end of every required field label:
SUIT_CONFIG = {
'SHOW_REQUIRED_ASTERISK': True
}
CONFIRM_UNSAVED_CHANGES¶
Alert will be shown, when you’ll try to leave page, without saving changed form first:
SUIT_CONFIG = {
'CONFIRM_UNSAVED_CHANGES': True
}