Welcome to django-adminlte2-templates’s documentation!¶
django-adminlte2-templates provides templates to easily integrate AdminLTE 2 to your Django projects. Also included in the package is an optional AdminLTE-based theme for Django Admin.
This Django module assumes that you have prior experience with AdminLTE 2. Please check the AdminLTE 2 documentation online for your reference.
For a live version of the example project of this app, please check https://djangoadminlte2templates.pythonanywhere.com/.
Installation¶
Installation¶
Installing using pip:
pip install django-adminlte2-templates
Add adminlte2_templates
to INSTALLED_APPS
:
INSTALLED_APPS = [
'adminlte2_templates',
'adminlte2_admin', # Optional Django Admin theme
..
]
Add adminlte2_templates.context_processors.template
to context_processors
:
TEMPLATES = [
...
'OPTIONS': {
'context_processors': [
...
'adminlte2_templates.context_processors.template',
],
...
]
Static files¶
This module provides static files for the following client-side libraries out-of-the-box:
- AdminLTE 2.4.18 (
static/adminlte2/adminlte-2.4.18
) - Bootstrap 3.4.1 (
static/adminlte2/bootstrap-3.4.1
) - DataTables 1.10.21 (
static/adminlte2/datatables-1.10.21
) - Font Awesome 4.7.0 (
static/adminlte2/fontawesome-4.7.0
) - HTML5Shiv 3.7.3 (
static/adminlte2/html5shiv-3.7.3
) - jQuery 3.5.1 (
static/adminlte2/jquery-3.5.1
) - Respond.js 1.4.2 (
static/adminlte2/respond-1.4.2
) - Select2 4.0.13 (
static/adminlte2/select2-4.0.13
)
Quickstart¶
Hint
An example Django project example_project
is included in the module for your reference.
Warning
This quickstart assumes you already have django-adminlte2-templates installed. If you do not, please check the Installation section for more details.
Using a layout template¶
Note
For more information on the available layout and component templates, please check the Layouts and Components section. You may also check the Template Blocks section for more details on the available block tags to use.
In this example, we will extend the fixed sidebar template (adminlte2/layouts/fixed.html
).
Extending adminlte2/layouts/fixed.html
:
{% extends 'adminlte2/layouts/fixed.html' %}
{% block title %}Fixed Layout{% endblock title %}
{% block page_title %}Fixed Layout{% endblock page_title %}
{% block page_description %}Example for extending the <i>fixed</i> sidebar template{% endblock page_description %}
{% block breadcrumbs %}
<li><a href="{% url 'layouts:index' %}">Layouts</a></li>
<li><a href="{% url 'layouts:fixed' %}">Fixed</a></li>
{% endblock breadcrumbs %}
{% block content %}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">Title</h3>
</div>
<div class="box-body">
Body
</div>
<div class="box-footer">
Footer
</div>
</div>
{% endblock content %}
Using the extended template will generate:
You can also override the sidebar (adminlte2/components/sidebar.html
), header (adminlte2/components/header.html
),
and footer (adminlte2/components/footer.html
) component templates to update their content:
Overriding adminlte2/components/sidebar.html
:
{% extends 'adminlte2/components/sidebar.html' %}
{% block sidebar_items %}
<li class="treeview active">
<a href="#">
<i class="fa fa-circle"></i> <span>Layouts</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
<li><a href="{% url 'layouts:boxed' %}"><i class="fa fa-circle-o"></i> Boxed</a></li>
<li><a href="{% url 'layouts:collapsed' %}"><i class="fa fa-circle-o"></i> Collapsed</a></li>
<li class="active"><a href="{% url 'layouts:fixed' %}"><i class="fa fa-circle-o"></i> Fixed</a></li>
<li><a href="{% url 'layouts:top' %}"><i class="fa fa-circle-o"></i> Top Navigation</a></li>
</ul>
</li>
{% endblock sidebar_items %}
Overriding adminlte2/components/header.html
:
{% extends 'adminlte2/components/header.html' %}
{% block logo_lg %}
<b>Ex</b>ample
{% endblock logo_lg %}
{% block logo_mini %}
<b>Ex</b>
{% endblock logo_mini %}
{% block header_items %}
<li><a href="#"><i class="fa fa-user"></i> Profile</a></li>
<li><a href="#"><i class="fa fa-sign-out"></i> Sign Out</a></li>
{% endblock header_items %}
Overriding adminlte2/components/footer.html
:
{% extends 'adminlte2/components/footer.html' %}
{% block footer_version %}
1.0.0
{% endblock footer_version %}
Overriding the aforementioned component templates will generate:
Setting settings.py
variables¶
Note
For more information on the available settings.py
variables that you can use, please check the Settings section.
You can change the AdminLTE 2 skin theme by adding ADMINLTE_SKIN_THEME
to settings.py
:
#
# Valid values are: 'skin-black', 'skin-black-light', 'skin-blue', 'skin-blue-light',
# 'skin-green', 'skin-green-light', 'skin-purple', 'skin-purple-light',
# 'skin-red', 'skin-red-light', 'skin-yellow', 'skin-yellow-light'.
#
# Defaults to 'skin-blue'.
#
ADMINLTE_SKIN_THEME = 'skin-orange-light'
Updating the page will generate:
Using template tags¶
Note
For more information on the available template tags that you can use, please check the Template Tags section.
You can use the {% add_active %}
template tag to automate setting the sidebar links of the current page as active.
For example, updating the sidebar adminlte2/components/sidebar.html
component template:
{% extends 'adminlte2/components/sidebar.html' %}
{% load adminlte2_tags %}
{% block sidebar_items %}
<li class="treeview {% add_active 'layouts:index' %}">
<a href="#">
<i class="fa fa-circle"></i> <span>Layouts</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
<li class="{% add_active 'layouts:boxed' %}"><a href="{% url 'layouts:boxed' %}"><i class="fa fa-circle-o"></i> Boxed</a></li>
<li class="{% add_active 'layouts:collapsed' %}"><a href="{% url 'layouts:collapsed' %}"><i class="fa fa-circle-o"></i> Collapsed</a></li>
<li class="{% add_active 'layouts:fixed' %}"><a href="{% url 'layouts:fixed' %}"><i class="fa fa-circle-o"></i> Fixed</a></li>
<li class="{% add_active 'layouts:top' %}"><a href="{% url 'layouts:top' %}"><i class="fa fa-circle-o"></i> Top Navigation</a></li>
</ul>
</li>
{% endblock sidebar_items %}
Layouts and Components¶
Layouts¶
-
adminlte2/base.html
Base AdminLTE 2 layout template.
-
adminlte2/layouts/boxed.html
AdminLTE 2 template for boxed layout option.
See https://adminlte.io/themes/AdminLTE/pages/layout/boxed.html for a live example of this template.
-
adminlte2/layouts/collapsed_sidebar.html
AdminLTE 2 template for collapsed sidebar layout option.
See https://adminlte.io/themes/AdminLTE/pages/layout/collapsed-sidebar.html for a live example of this template.
-
adminlte2/layouts/fixed.html
AdminLTE 2 template for fixed layout option.
See https://adminlte.io/themes/AdminLTE/pages/layout/fixed.html for a live example of this template.
-
adminlte2/layouts/top_navigation.html
AdminLTE 2 template for top navigation layout option.
See https://adminlte.io/themes/AdminLTE/pages/layout/top-nav.html for a live example of this template.
Pages¶
-
adminlte2/layouts/login.html
AdminLTE 2 login page template.
See https://adminlte.io/themes/AdminLTE/pages/examples/login.html for a live example of this template.
-
adminlte2/layouts/register.html
AdminLTE 2 register page template.
See https://adminlte.io/themes/AdminLTE/pages/examples/register.html for a live example of this template.
Components¶
-
adminlte2/components/sidebar.html
Sidebar navigation template.
Please check the Template Blocks > Layouts > Sidebar section for more information on the available template blocks that can be used to customize this component.
-
adminlte2/components/control.html
Control navigation template.
Please check the Template Blocks > Layouts > Control section for more information on the available template blocks that can be used to customize this component.
-
adminlte2/components/header.html
Header navigation bar template for boxed, collapsed sidebar, and fixed layout options.
Please check the Template Blocks > Layouts > Header section for more information on the available template blocks that can be used to customize this component.
-
adminlte2/components/header_top_navigation.html
Header navigation bar template for top navigation layout option.
Please check the Template Blocks > Layouts > Header section for more information on the available template blocks that can be used to customize this component.
-
adminlte2/components/messages.html
Django Messages alert box template.
Please check the Template Blocks > Layouts > Messages section for more information on the available template blocks that can be used to customize this component.
-
adminlte2/components/footer.html
Footer template.
Please check the Template Blocks > Layouts > Footer section for more information on the available template blocks that can be used to customize this component.
-
adminlte2/components/footer_top_navigation.html
Footer template for top navigation layout option.
Please check the Template Blocks > Layouts > Footer section for more information on the available template blocks that can be used to customize this component.
Shortcuts¶
django-adminlte2-templates provides shortcuts to some commonly-used layout template modifications:
-
adminlte2/shortcuts/barebones/*
Remove content header (page title, page description, breadcrumb navigation), footer, and control sidebar for
boxed.html
,collapsed_sidebar.html
,fixed.html
, andtop_navigation.html
.
-
adminlte2/shortcuts/no_content_header/*
Remove content header (page title, page description, breadcrumb navigation) for
boxed.html
,collapsed_sidebar.html
,fixed.html
, andtop_navigation.html
.
-
adminlte2/shortcuts/no_breadcrumbs/*
Remove breadcrumb navigation for
boxed.html
,collapsed_sidebar.html
,fixed.html
, andtop_navigation.html
.
-
adminlte2/shortcuts/no_footer/*
Remove footer for
boxed.html
,collapsed_sidebar.html
,fixed.html
, andtop_navigation.html
.
-
adminlte2/shortcuts/no_breadcrumbs_footer/*
Remove footer and breadcrumb navigation for
boxed.html
,collapsed_sidebar.html
,fixed.html
, andtop_navigation.html
.
Extras¶
-
adminlte2/extras/paginator.html
Layout template file for template tag
{% paginator %}
.Please check the Template Tags > Tags section for more information on
{% paginator %}
. You may also check the Template Blocks > Extras > Paginator section for more information on the available template blocks that can be used to customize this template.
Template Blocks¶
django-adminlte2-templates template blocks:
General¶
<html> content¶
-
html_attribute
HTML
<html>
attributes.Default:
<html {% block html_attribute %}lang="{% block html_lang %}{{ ADMINLTE_HTML_LANG }}{% endblock html_lang %}" dir="{% block html_lang_bidi %}{{ ADMINLTE_HTML_LANG_BIDI }}{% endblock html_lang_bidi %}" {% endblock html_attribute %}>
-
html_lang
HTML
<html>
lang
attribute.Default:
lang="{% block html_lang %}{{ ADMINLTE_HTML_LANG }}{% endblock html_lang %}"
-
html_lang_bidi
HTML
<html>
dir
attributeDefault:
dir="{% block html_lang_bidi %}{{ ADMINLTE_HTML_LANG_BIDI }}{% endblock html_lang_bidi %}"
<head> content¶
-
extra_head
Additional HTML tags in
<head>
.
-
meta
<meta>
tags in<head>
.Default:
{% block meta %} {% include 'adminlte2/components/_meta.html' %} {% endblock meta %}
-
title
HTML
<title>
tag text.
-
stylesheets
CSS links in
<head>
.Default:
{% block stylesheets %} {% include 'adminlte2/components/_stylesheets.html' %} {% endblock stylesheets %}
-
stylesheets_fix
Custom CSS links in
<head>
. Included custom CSS files are:adminlte2/fix/header_dropdown_link_color.css
: Custom CSS to fix header dropdown link color without using.notifications-menu
,.messages-menu
, or.tasks-menu
classes
Default:
{% block stylesheets_fix %} {% include 'adminlte2/components/_stylesheets_fix.html' %} {% endblock stylesheets_fix %}
-
favicon
Favicon links in
<head>
:Default:
{% block favicon %} <link rel="shortcut icon" href="{% block favicon_icon %}{% static 'favicon.ico' %}{% endblock favicon_icon %}"> {% endblock favicon %}
-
favicon_image
Favicon image path.
Default:
<link rel="shortcut icon" href="{% block favicon_icon %}{% static 'favicon.ico' %}{% endblock favicon_icon %}">
-
shim
HTML 5 Shim JavaScript links in
<head>
.Default:
{% block shim %} {% if ADMINLTE_USE_SHIM %} {% include 'adminlte2/components/_shim.html' %} {% endif %} {% endblock shim %}
-
javascripts
JavaScript links in
<head>
.Default:
{% block javascripts %} {% include 'adminlte2/components/_javascripts.html' %} {% endblock javascripts %}
<body> content¶
-
body
HTML
<body>
tag content.
-
body_attribute
HTML
<body>
attributes.Default:
<body {% block body_attribute %}class="{% block body_class %}hold-transition {% block skin_style %}{{ ADMINLTE_SKIN_STYLE }}{% endblock skin_style %}{% endblock body_class %}"{% endblock body_attribute %}>
-
body_class
HTML
<body>
tagclass
attributes.Default:
{% block body_class %}hold-transition {{ ADMINLTE_SKIN_STYLE }}{% endblock body_class %}
-
skin_style
HTML
<body>
tagclass
attribute for AdminLTE 2 skin theme.Valid values are:
'skin-black'
,'skin-black-light'
,'skin-blue'
,'skin-blue-light'
,'skin-green'
,'skin-green-light'
,'skin-purple'
,'skin-purple-light'
,'skin-red'
,'skin-red-light'
,'skin-yellow'
,'skin-yellow-light'
.
-
javascripts_body
JavaScript links in
<body>
.
Layouts¶
Sidebar and top navigation layout template blocks:
Templates¶
-
header_template
AdminLTE 2 navigation header template.
Default:
{% block header_template %} {% include 'adminlte2/components/header.html' %} {% endblock header_template %}
-
sidebar_template
AdminLTE 2 navigation sidebar template.
Default:
{% block sidebar_template %} {% include 'adminlte2/components/sidebar.html' %} {% endblock sidebar_template %}
-
messages_template
¶ Django
messages
alert box template.Default:
{% block messages_template %} {% include 'adminlte2/components/messages.html' %} {% endblock messages_template %}
-
control_template
¶ AdminLTE 2 control sidebar template.
Default:
{% block control_template %} {% include 'adminlte2/components/control.html %} {% endblock control_template %}
AdminLTE 2 footer template.
Default:
{% block footer_template %} {% include 'adminlte2/components/footer.html' %} {% endblock footer_template %}
Content¶
-
content_template
AdminLTE 2 page content code.
Default:
{% block content_template %} <div class="content-wrapper"> {% block content_wrapper %} {% block no_content_header %} <section class="content-header"> {% block content_header %} {% block no_page_title %} <h1> {% block page_title %}{% endblock page_title %} <small>{% block page_description %}{% endblock page_description %}</small> </h1> {% endblock no_page_title %} {% block no_breadcrumbs %} <ol class="breadcrumb"> {% block breadcrumbs %}{% endblock breadcrumbs %} </ol> {% endblock no_breadcrumbs %} {% endblock content_header %} </section> {% endblock no_content_header %} {% block content_body %} <section class="content"> {% block messages_template %} {% include 'adminlte2/components/messages.html' %} {% endblock messages_template %} {% block content %} {% endblock content %} </section> {% endblock content_body %} {% endblock content_wrapper %} </div> {% endblock content_template %}
-
content_wrapper
Page content
<div class="content-wrapper">
code.
-
content_header
Page content header code. Contains the page title and description, and breadcrumb navigation.
Default:
{% block content_header %} {% block no_page_title %} <h1> {% block page_title %}{% endblock page_title %} <small>{% block page_description %}{% endblock page_description %}</small> </h1> {% endblock no_page_title %} {% block no_breadcrumbs %} <ol class="breadcrumb"> {% block breadcrumbs %}{% endblock breadcrumbs %} </ol> {% endblock no_breadcrumbs %} {% endblock content_header %}
-
no_content_header
Declare block as empty to remove page content header (page title and description, breadcrumb navigation):
{% block no_content_header %}{% endblock no_content_header %}
-
page_title
Page title text that will be displayed in the content header.
-
page_description
Page description text that will be displayed in the content header.
-
no_page_title
Declare block as empty to remove page title and description text:
{% block no_page_title %}{% endblock no_page_title %}
-
breadcrumbs
Breadcrumb navigation that will be displayed in the content header.
-
no_breadcrumbs
Declare block as empty to remove breadcrumb navigation:
{% block no_breadcrumbs %}{% endblock no_breadcrumbs %}
-
content_body
Page content body code. Contains the Django
messages
alert boxes and page main content.Default:
{% block content_body %} <section class="content"> {% block messages_template %} {% include 'adminlte2/components/messages.html' %} {% endblock messages_template %} {% block content %} {% endblock content %} </section> {% endblock content_body %}
-
content
Page main content.
Header¶
Template blocks to customize the header component (adminlte2/components/header.html
, adminlte2/components/header_top_navigation.html
).
django-adminlte2-templates supports header for both sidebar (boxed, collapsed, fixed) and top navigation layouts:
-
logo
Header logo code.
Default for sidebar:
{% block logo %} <a href="{% block logo_href %}/{% endblock %}" class="logo"> <span class="logo-mini">{% block logo_mini %}<b>A</b>LTE{% endblock logo_mini %}</span> <span class="logo-lg">{% block logo_lg %}<b>Admin</b>LTE{% endblock logo_lg %}</span> </a> {% endblock logo %}
Default for top navigation:
{% block logo %} <a href="{% block logo_href %}/{% endblock logo_href %}" class="navbar-brand"> {% block logo_lg %} <b>Admin</b>LTE {% endblock logo_lg %} </a> {% endblock logo %}
-
logo_href
Header logo link URL.
Defaults to
/
.
-
logo_mini
(sidebar only) Header logo content when the sidebar content is collapsed.
Default:
{% block logo_mini %}<b>A</b>LTE{% endblock logo_mini %}
-
logo_lg
Header logo content when sidebar content is exposed, or for top navigation layout.
Default:
{% block logo_lg %}<b>Admin</b>LTE{% endblock logo_lg %}
-
header_content
Header main content code.
Default for sidebar:
{% block header_content %} <nav class="navbar navbar-static-top"> {% block sidebar_toggle %} <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button"> <span class="sr-only"> {% block sidebar_toggle_text %}Toggle navigation{% endblock sidebar_toggle_text %} </span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> {% endblock sidebar_toggle %} <div class="navbar-custom-menu"> <ul class="nav navbar-nav"> {% block header_items %} {% endblock header_items %} </ul> </div> </nav> {% endblock header_content %}
Default for top navigation:
{% block header_content %} <div class="collapse navbar-collapse pull-left" id="navbar-collapse"> <ul class="nav navbar-nav"> {% block header_items_left %} {% endblock header_items_left %} </ul> </div> <div class="navbar-custom-menu"> <ul class="nav navbar-nav"> {% block header_items %} {% block header_items_right %} {% endblock header_items_right %} {% endblock header_items %} </ul> </div> {% endblock header_content %}
-
header_items
Header (right) navigation items.
-
header_items_left
(top navigation only) Header left navigation items.
-
header_items_right
(top navigation only) Header right navigation items. Alias for
header_items
.Default:
{% block header_items %} {% block header_items_right %} {% endblock header_items_right %} {% endblock header_items %}
-
sidebar_toggle
(sidebar only) Sidebar toggle button for sidebar (boxed, collapsed, fixed) layouts.
Default:
{% block sidebar_toggle %} <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button"> <span class="sr-only"> {% block sidebar_toggle_text %}Toggle navigation{% endblock sidebar_toggle_text %} </span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> {% endblock sidebar_toggle %}
-
sidebar_toggle_text
(sidebar only) Sidebar toggle button screenreader text for sidebar (boxed, collapsed, fixed) layouts.
Defaults to
Toggle navigation
.
-
header_toggle
(top navigation only) Responsive toggle button for left navigation links.
Default:
{% block header_toggle %} <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse"> <span class="sr-only"> {% block header_toggle_text %}Toggle navigation{% endblock header_toggle_text %} </span> <i class="fa fa-bars"></i> </button> {% endblock header_toggle %}
-
header_toggle_text
¶ (top navigation only) Responsive toggle button screenreader text for left navigation links.
Defaults to
Toggle navigation
.
Sidebar¶
Template blocks to customize the sidebar component (adminlte2/components/sidebar.html
):
-
sidebar_title
Sidebar navigation title text.
Default:
<li class="header">{% block sidebar_title %}MAIN NAVIGATION{% endblock sidebar_title %}</li>
-
no_sidebar_title
Declare block as empty to remove sidebar title:
{% block no_sidebar_title %}{% endblock no_sidebar_title %}
-
sidebar_form
Sidebar space for form elements.
-
sidebar_items
Sidebar navigation items.
Control¶
Template blocks to customize the control component (adminlte2/components/control.html
):
-
control_items
Control sidebar navigation items.
-
control_tabs
Control sidebar navigation tab contents.
Messages¶
Template blocks to customize the Django messages
alert boxes component (adminlte2/components/messages.html
):
-
message_debug
DEBUG
alert box.Default:
<div class="alert alert-info alert-dismissible"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> {{ message }} </div>
-
message_info
INFO
alert box.Default:
<div class="alert alert-info alert-dismissible"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> {{ message }} </div>
-
message_success
SUCCESS
alert box.Default:
<div class="alert alert-success alert-dismissible"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> {{ message }} </div>
-
message_warning
WARNING
alert box.Default:
<div class="alert alert-warning alert-dismissible"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> {{ message }} </div>
-
message_error
ERROR
alert box.Default:
<div class="alert alert-error alert-dismissible"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> {{ message }} </div>
-
message_default
Custom message alert box.
Default:
<div class="alert alert-info alert-dismissible"> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> {{ message }} </div>
Pages¶
Login¶
-
login_logo
Login logo code.
Default:
{% block login_logo %} <div class="login-logo"> <a href="{% block login_logo_href %}/{% endblock login_logo_href %}"> {% block login_logo_text %} <b>Admin</b>LTE {% endblock login_logo_text %} </a> </div> {% endblock login_logo %}
-
login_logo_href
Login logo link URL.
Defaults to
/
.
-
login_logo_text
Login logo content.
Default:
{% block login_logo_text %} <b>Admin</b>LTE {% endblock login_logo_text %}
-
login_content
Login page main content code.
Default:
{% block login_content %} <div class="login-box-body"> {% block messages_template %} {% include 'adminlte2/components/messages.html' %} {% endblock messages_template %} {% block login_custom_messages %} {% endblock login_custom_messages %} <p class="login-box-msg"> {% block login_description %} Sign in to start your session {% endblock login_description %} </p> {% block login_form %} <form action="{% block login_form_action %}{% endblock login_form_action %}" id="{% block login_form_id %}login-id{% endblock login_form_id %}" method="{% block login_form_method %}POST{% endblock login_form_method %}"> {% csrf_token %} {% if next %} <input type="hidden" name="next" value="{{ next }}"> {% endif %} {% block login_form_non_field_errors %} {% if form.non_field_errors %} <div class="text-danger"> {{ form.non_field_errors }} </div> {% endif %} {% endblock login_form_non_field_errors %} {% block login_form_fields %} {% for field in form %} <div class="form-group {% if field.errors %}has-error{% endif %}"> {{ field.label_tag }} {% if field.errors %} <div class="text-danger"> {{ field.errors }} </div> {% endif %} {{ field|add_class:'form-control' }} {% if field.help_text %} <p class="help-block">{{ field.help_text|safe }}</p> {% endif %} </div> {% endfor %} {% endblock login_form_fields %} {% block login_form_buttons %} <button class="btn btn-primary" type="submit">Log in</button> <button class="btn btn-default" type="reset">Clear</button> {% endblock login_form_buttons %} </form> {% endblock login_form %} <div class="social-auth-links text-center"> {% block login_social_auth %} {% endblock login_social_auth %} </div> {% block login_links %} {% endblock login_links %} </div> {% endblock login_content %}
-
messages_template
¶ Django
messages
alert box template.Default:
{% block messages_template %} {% include 'adminlte2/components/messages.html' %} {% endblock messages_template %}
-
login_custom_messages
¶ Custom Django
messages
alert boxes.
-
login_description
Login page description.
Defaults to
Sign in to start your session
.
-
login_form
Login form code.
Default:
{% block login_form %} <form action="{% block login_form_action %}{% endblock login_form_action %}" id="{% block login_form_id %}login-id{% endblock login_form_id %}" method="{% block login_form_method %}POST{% endblock login_form_method %}"> {% csrf_token %} {% if next %} <input type="hidden" name="next" value="{{ next }}"> {% endif %} {% block login_form_non_field_errors %} {% if form.non_field_errors %} <div class="text-danger"> {{ form.non_field_errors }} </div> {% endif %} {% endblock login_form_non_field_errors %} {% block login_form_fields %} {% for field in form %} <div class="form-group {% if field.errors %}has-error{% endif %}"> {{ field.label_tag }} {% if field.errors %} <div class="text-danger"> {{ field.errors }} </div> {% endif %} {{ field|add_class:'form-control' }} {% if field.help_text %} <p class="help-block">{{ field.help_text|safe }}</p> {% endif %} </div> {% endfor %} {% endblock login_form_fields %} {% block login_form_buttons %} <button class="btn btn-primary" type="submit">Log in</button> <button class="btn btn-default" type="reset">Clear</button> {% endblock login_form_buttons %} </form> {% endblock login_form %}
-
login_form_aciton
¶ Login
<form>
tagaction
attribute.Defaults to blank.
-
login_form_id
¶ Login
<form>
tagid
attribute.Defaults to
login-id
.
-
login_form_method
¶ Login
<form>
tagmethod
attribute.Defaults to
POST
.
-
login_form_non_field_errors
¶ Login non-field errors.
Default:
{% block login_form_non_field_errors %} {% if form.non_field_errors %} <div class="text-danger"> {{ form.non_field_errors }} </div> {% endif %} {% endblock login_form_non_field_errors %}
-
login_form_fields
¶ Login form fields.
Default:
{% block login_form_fields %} {% for field in form %} <div class="form-group {% if field.errors %}has-error{% endif %}"> {{ field.label_tag }} {% if field.errors %} <div class="text-danger"> {{ field.errors }} </div> {% endif %} {{ field|add_class:'form-control' }} {% if field.help_text %} <p class="help-block">{{ field.help_text|safe }}</p> {% endif %} </div> {% endfor %} {% endblock login_form_fields %}
Login form buttons.
Default:
{% block login_form_buttons %} <button class="btn btn-primary" type="submit">Log in</button> <button class="btn btn-default" type="reset">Clear</button> {% endblock login_form_buttons %}
-
login_social_auth
Login social authentication links.
-
login_links
Login links.
Register¶
-
register_logo
Register logo code.
Default:
{% block register_logo %} <div class="register-logo"> <a href="{% block register_logo_href %}/{% endblock register_logo_href %}"> {% block register_logo_text %} <b>Admin</b>LTE {% endblock register_logo_text %} </a> </div> {% endblock register_logo %}
-
register_logo_href
Register logo link URL.
Defaults to
/
.
-
register_logo_text
Register logo content.
Default:
{% block register_logo_text %} <b>Admin</b>LTE {% endblock register_logo_text %}
-
register_content
Register page main content code.
Default:
{% block register_content %} <div class="register-box-body"> <p class="register-box-msg"> {% block register_description %} Register a new membership {% endblock register_description %} </p> {% block register_form %} <form action="{% block register_form_action %}{% endblock register_form_action %}" id="{% block register_form_id %}register-id{% endblock register_form_id %}" method="{% block register_form_method %}POST{% endblock register_form_method %}"> {% csrf_token %} {% block register_form_non_field_errors %} {% if form.non_field_errors %} <div class="text-danger"> {{ form.non_field_errors }} </div> {% endif %} {% endblock register_form_non_field_errors %} {% block register_form_fields %} {% for field in form %} <div class="form-group {% if field.errors %}has-error{% endif %}"> {{ field.label_tag }} {% if field.errors %} <div class="text-danger"> {{ field.errors }} </div> {% endif %} {{ field|add_class:'form-control' }} {% if field.help_text %} <p class="help-block">{{ field.help_text|safe }}</p> {% endif %} </div> {% endfor %} {% endblock register_form_fields %} {% block register_form_buttons %} <button class="btn btn-primary" type="submit">Submit</button> <button class="btn btn-default" type="reset">Clear</button> {% endblock register_form_buttons %} </form> {% endblock register_form %} <div class="social-auth-links text-center"> {% block register_social_auth %} {% endblock register_social_auth %} </div> {% block register_links %} {% endblock register_links %} </div> {% endblock register_content %}
-
messages_template
Django
messages
alert box template.Default:
{% block messages_template %} {% include 'adminlte2/components/messages.html' %} {% endblock messages_template %}
-
register_custom_messages
¶ Custom Django
messages
alert boxes.
-
register_description
Register page description.
Defaults to
Register a new membership
.
-
register_form
Register form code.
Default:
{% block register_form %} <form action="{% block register_form_action %}{% endblock register_form_action %}" id="{% block register_form_id %}register-id{% endblock register_form_id %}" method="{% block register_form_method %}POST{% endblock register_form_method %}"> {% csrf_token %} {% block register_form_non_field_errors %} {% if form.non_field_errors %} <div class="text-danger"> {{ form.non_field_errors }} </div> {% endif %} {% endblock register_form_non_field_errors %} {% block register_form_fields %} {% for field in form %} <div class="form-group {% if field.errors %}has-error{% endif %}"> {{ field.label_tag }} {% if field.errors %} <div class="text-danger"> {{ field.errors }} </div> {% endif %} {{ field|add_class:'form-control' }} {% if field.help_text %} <p class="help-block">{{ field.help_text|safe }}</p> {% endif %} </div> {% endfor %} {% endblock register_form_fields %} {% block register_form_buttons %} <button class="btn btn-primary" type="submit">Register</button> <button class="btn btn-default" type="reset">Clear</button> {% endblock register_form_buttons %} </form> {% endblock register_form %}
-
register_form_aciton
¶ Register
<form>
tagaction
attribute.Defaults to blank.
-
register_form_id
¶ Register
<form>
tagid
attribute.Defaults to
register-id
.
-
register_form_method
¶ Register
<form>
tagmethod
attribute.Defaults to
POST
.
-
register_form_non_field_errors
¶ Register non-field errors.
Default:
{% block register_form_non_field_errors %} {% if form.non_field_errors %} <div class="text-danger"> {{ form.non_field_errors }} </div> {% endif %} {% endblock register_form_non_field_errors %}
-
register_form_fields
¶ Register form fields.
Default:
{% block register_form_fields %} {% for field in form %} <div class="form-group {% if field.errors %}has-error{% endif %}"> {{ field.label_tag }} {% if field.errors %} <div class="text-danger"> {{ field.errors }} </div> {% endif %} {{ field|add_class:'form-control' }} {% if field.help_text %} <p class="help-block">{{ field.help_text|safe }}</p> {% endif %} </div> {% endfor %} {% endblock register_form_fields %}
Register form buttons.
Default:
{% block register_form_buttons %} <button class="btn btn-primary" type="submit">Register</button> <button class="btn btn-default" type="reset">Clear</button> {% endblock register_form_buttons %}
-
register_social_auth
Register social authentication links.
-
register_links
Register links.
Extras¶
Paginator¶
-
paginator_template
Paginator template
Default:
{% block paginator_template %} <nav {% if align %}class="{{ align }}"{% endif %}> <ul id="{% block paginator_id %}pagination{% endblock paginator_id %}" class="{% block paginator_class %}pagination{% if no_margin %} no-margin{% endif %}{% endblock paginator_class %}"> {% block paginator_content %} {% block first %} {% if show_first %} <li> <a href="?page=1"> {% block first_text %}<small>First</small>{% endblock first_text %} </a> </li> {% endif %} {% endblock first %} {% block prev %} {% if has_prev %} <li> <a href="?page={{ prev_page }}"> {% block prev_text %}<i class="fa fa-caret-left"></i>{% endblock prev_text %} </a> </li> {% endif %} {% endblock prev %} {% block pages %} {% for link_page in page_numbers %} {% ifequal link_page current_page %} {% block current %} <li class="active"> <a href="?page={{ link_page }}"> {% block current_text %} {{ current_page }} {% endblock current_text %} </a> </li> {% endblock current %} {% else %} {% block link %} <li> <a href="?page={{ link_page }}"> {% block link_text %} {{ link_page }} {% endblock link_text %} </a> </li> {% endblock link %} {% endifequal %} {% endfor %} {% endblock pages %} {% block next %} {% if has_next %} <li> <a href="?page={{ next_page }}"> {% block next_text %} <i class="fa fa-caret-right"></i> {% endblock next_text %} </a> </li> {% endif %} {% endblock next %} {% block last %} {% if show_last %} <li> <a href="?page=last"> {% block last_text %}<small>Last</small>{% endblock last_text %} </a> </li> {% endif %} {% endblock last %} {% endblock paginator_content %} </ul> </nav> {% endblock paginator_template %}
-
paginator_id
Paginator element
id
attribute, defaults topagination
.
-
paginator_class
Paginator element class names.
Default:
class="{% block paginator_class %}pagination{% if no_margin %} no-margin{% endif %}{% endblock paginator_class %}"
-
paginator_content
Paginator main content code.
-
first
First page link code.
Default:
{% block first %} {% if show_first %} <li> <a href="?page=1"> {% block first_text %}<small>First</small>{% endblock first_text %} </a> </li> {% endif %} {% endblock first %}
-
first_text
First page link text.
Default:
{% block first_text %}<small>First</small>{% endblock first_text %}
-
prev
Previous page link code.
Default:
{% block prev %} {% if has_prev %} <li> <a href="?page={{ prev_page }}"> {% block prev_text %}<i class="fa fa-caret-left"></i>{% endblock prev_text %} </a> </li> {% endif %} {% endblock prev %}
-
prev_text
Previous page link text.
Default:
{% block prev_text %}<i class="fa fa-caret-left"></i>{% endblock prev_text %}
-
pages
Page number links code.
Default:
{% block pages %} {% for link_page in page_numbers %} {% ifequal link_page current_page %} {% block current %} <li class="active"> <a href="?page={{ link_page }}"> {% block current_text %} {{ current_page }} {% endblock current_text %} </a> </li> {% endblock current %} {% else %} {% block link %} <li> <a href="?page={{ link_page }}"> {% block link_text %} {{ link_page }} {% endblock link_text %} </a> </li> {% endblock link %} {% endifequal %} {% endfor %} {% endblock pages %}
-
current
Current page number link code.
Default:
{% block current %} <li class="active"> <a href="?page={{ link_page }}"> {% block current_text %} {{ current_page }} {% endblock current_text %} </a> </li> {% endblock current %}
-
current_text
Current page number link text.
Default:
{% block current_text %} {{ current_page }} {% endblock current_text %}
-
link
Adjacent page number link code.
Default:
{% block link %} <li> <a href="?page={{ link_page }}"> {% block link_text %} {{ link_page }} {% endblock link_text %} </a> </li> {% endblock link %}
-
link_text
¶ Adjacent page number link text.
Default:
{% block link_text %} {{ link_page }} {% endblock link_text %}
-
next
¶ Next page link code.
Default
{% block next %} {% if has_next %} <li> <a href="?page={{ next_page }}"> {% block next_text %} <i class="fa fa-caret-right"></i> {% endblock next_text %} </a> </li> {% endif %} {% endblock next %}
-
next_text
¶ Next page link text.
Default:
{% block next_text %} <i class="fa fa-caret-right"></i> {% endblock next_text %}
-
last
¶ Last page link code.
Default:
{% block last %} {% if show_last %} <li> <a href="?page=last"> {% block last_text %}<small>Last</small>{% endblock last_text %} </a> </li> {% endif %} {% endblock last %}
-
last_text
¶ Last page link text.
Default:
{% block last_text %}<small>Last</small>{% endblock last_text %}
Template Tags and Filters¶
django-adminlte2-templates provides several template tags and filters that can be used by adding {% load adminlte2_tags %}
to your layout templates:
Tags¶
-
{% add_active %}
Add HTML class name
active
to sidebar and header navigation links based on comparison of given URL pattern with current URL.Parameters:
- url_pattern:
- (str) URL pattern for
reverse
matching or raw URL string. - exact_match:
- (bool, optional) Toggle for exact matching, defaults to
False
. - not_when:
- (str, optional) Comma-separated string of patterns that will render comparison as
False
, defaults to''
. - *args and **kwargs
- For URL
reverse
matching.
Example:
<li class="{% add_active 'app:page' object.pk %}"> <a href="{% url 'app:page' object.pk %}">Details</a> </li>
-
{% gravatar_url %}
Generates a Gravatar URL based on the details of the current user.
For your convenience, you can also set the parameters related to this tag in Django
settings.py
. Please check the Settings > Gravatar section for more information.To know more about Gravatar request parameters, please check the Gravatar Image Request documentation for more information.
Parameters:
- user:
- (User object, optional) User object, defaults to context
user
. - size:
- (int, optional) Image size. You may request images anywhere from
1
up to2048
, however note that many users have lower resolution images, so requesting larger sizes may result in pixelation/low-quality images. Defaults to80
. - default:
- (str, optional) Default Gravatar image to load. You can supply your own default image by supplying the URL to an image.
Alternatively, you can use any of these valid values:
'404'
,'mp'
,'identicon'
,'monsterid'
,'wavatar'
,'retro'
,'robohash'
,'blank'
. Defaults to'mp'
. - force_default:
- (bool, optional) Toggle to force load default Gravatar image, defaults to
False
. - rating:
- (str, optional) Gravatar image rating. Valid values are:
'g'
,'pg'
,'r'
,'x'
. Defaults to'pg'
.
Example:
<img src="{% gravatar_url %}" alt="User Avatar">
-
{% paginator %}
Generates an HTML code block for ListView pagination. HTML code output is based on template layout
adminlte2/extras/paginator.html
.You can customize the output by overriding the aforementioned layout and using the template blocks related to this tag. Please check the Template Blocks > Extras > Paginator section for more information.
Parameters:
- adjacent_pages
- (int, optional) Adjacent page links to current page link, defaults to
2
. - align
- (str, optional) Element alignment. Valid values are
'initial'
,'center'
,'left'
,'right'
, defaults to'initial'
. - no_margin
- (bool, optional) Toggle to remove margin around element, defaults to
False
.
Example:
{% if is_paginated %} {% paginator adjacent_pages=2 align="center" no_margin=True %} {% endif %}
-
{% page_title %}
Generates text for HTML <title> tag. Supports Django
sites
framework andListView
pagination.You can customize the output by using the settings related to this tag in Django
settings.py
. Please check the Settings > Page Title section for more information.Parameters:
- page_name
- (str, optional) Page title text. Adding
page_name
to the page context will override this parameter. Defaults to''
.
Example:
{% block title %}{% page_title 'Page Title' %}{% endblock title %}
Filters¶
-
add_class
Add HTML class names to a form field.
Example:
{% for field in form %} <div class="form-group {% if field.errors %}has-error{% endif %}"> {{ field.label_tag }} {% if field.errors %} <div class="text-danger"> {{ field.errors }} </div> {% endif %} {{ field|add_class:'form-control' }} {% if field.help_text %} <p class="help-block">{{ field.help_text|safe }}</p> {% endif %} </div> {% endfor %}
-
add_attr
Add HTML attribute values to a form field.
Example:
{% for field in form %} <div class="form-group {% if field.errors %}has-error{% endif %}"> {{ field.label_tag }} {% if field.errors %} <div class="text-danger"> {{ field.errors }} </div> {% endif %} {% if field.is_readonly %} {{ field.field|add_attr:'readonly' }} {% else %} {{ field.field }} {% endif %} {% if field.help_text %} <p class="help-block">{{ field.help_text|safe }}</p> {% endif %} </div> {% endfor %}
Settings¶
django-adminlte2-templates settings.py
variables:
CDN¶
-
ADMINLTE_USE_CDN
¶ (bool) Toggle to use CDN links for AdminLTE dependencies.
Defaults to
False
.
-
ADMINLTE_CDN_ADMINLTE_CSS_CORE
¶ (str) CDN link for AdminLTE 2.4.18 core CSS file.
Defaults to
'https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.18/css/AdminLTE.min.css'
.
-
ADMINLTE_CDN_ADMINLTE_CSS_SKIN
¶ (dict) CDN links for AdminLTE 2.4.18 skin CSS files.
Valid keys are:
'skin-black'
,'skin-black-light'
,'skin-blue'
,'skin-blue-light'
,'skin-green'
,'skin-green-light'
,'skin-purple'
,'skin-purple-light'
,'skin-red'
,'skin-red-light'
,'skin-yellow'
,'skin-yellow-light'
.Default:
{ 'skin-black': 'https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.18/css/skins/skin-black.min.css', 'skin-black-light': 'https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.18/css/skins/skin-black-light.min.css', 'skin-blue': 'https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.18/css/skins/skin-blue.min.css', 'skin-blue-light': 'https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.18/css/skins/skin-blue-light.min.css', 'skin-green': 'https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.18/css/skins/skin-green.min.css', 'skin-green-light': 'https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.18/css/skins/skin-green-light.min.css', 'skin-purple': 'https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.18/css/skins/skin-purple.min.css', 'skin-purple-light': 'https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.18/css/skins/skin-purple-light.min.css', 'skin-red': 'https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.18/css/skins/skin-red.min.css', 'skin-red-light': 'https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.18/css/skins/skin-red-light.min.css', 'skin-yellow': 'https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.18/css/skins/skin-yellow.min.css', 'skin-yellow-light': 'https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.18/css/skins/skin-yellow-light.min.css', }
-
ADMINLTE_CDN_ADMINLTE_JS_CORE
¶ (str) CDN link for AdminLTE 2.4.18 core JS file.
Defaults to
'https://cdnjs.cloudflare.com/ajax/libs/admin-lte/2.4.18/js/adminlte.min.js'
.
-
ADMINLTE_CDN_BOOTSTRAP_CSS_CORE
¶ (str) CDN link for Bootstrap 3.4.1 core CSS file.
Defaults to
'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css'
.
-
ADMINLTE_CDN_BOOTSTRAP_JS_CORE
¶ (str) CDN link for Bootstrap 3.4.1 core JS file.
Defaults to
'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js'
.
-
ADMINLTE_CDN_DATATABLES_CSS_CORE
¶ (str) CDN link for DataTables 1.10.21 core CSS file.
Defaults to
'https://cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css'
.
-
ADMINLTE_CDN_DATATABLES_JS_CORE
¶ (str) CDN link for DataTables 1.10.21 core JS file.
Defaults to
'https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js'
.
-
ADMINLTE_CDN_FONTAWESOME_CSS_CORE
¶ (str) CDN link for Font-Awesome 4.7.0 core CSS file.
Defaults to
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css'
.
-
ADMINLTE_CDN_JQUERY_JS_CORE
¶ (str) CDN link for jQuery 3.5.1 JS file.
Defaults to
'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js'
.
-
ADMINLTE_CDN_HTML5SHIV_JS_CORE
¶ (str) CDN link for HTML5 Shim script HTML5 Shiv JS file.
Defaults to
'https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js'
.
-
ADMINLTE_CDN_RESPOND_JS_CORE
¶ (str) CDN link for HTML5 Shim script Respond JS file.
Defaults to
'https://oss.maxcdn.com/respond/1.4.2/respond.min.js'
.
-
ADMINLTE_CDN_SELECT2_CSS_CORE
¶ (str) CDN link for Select2 4.0.13 core CSS file
Defaults to
'https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/css/select2.min.css'
.
-
ADMINLTE_CDN_SELECT2_JS_CORE
¶ (str) CDN link for Select2 4.0.13 core JS file
Defaults to
'https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/js/select2.min.js'
.
Gravatar¶
Global parameter values for template tag {% gravatar_url %}
.
Please check the Template Tags > Tags section for more information on {% gravatar_url %}
.
-
ADMINLTE_GRAVATAR_SIZE
¶ (int) Default Gravatar image size.
You may request images anywhere from
1
up to2048
, however note that many users have lower resolution images, so requesting larger sizes may result in pixelation/low-quality images.Defaults to
80
.
-
ADMINLTE_GRAVATAR_DEFAULT
¶ (str) Default Gravatar image to load.
You can supply your own default image by supplying the URL to an image. Alternatively, you can use any of these valid values:
'404'
,'mp'
,'identicon'
,'monsterid'
,'wavatar'
,'retro'
,'robohash'
,'blank'
.Defaults to
'mp'
.
-
ADMINLTE_GRAVATAR_FORCE_DEFAULT
¶ (bool) Toggle to force load the default Gravatar image.
Defaults to
False
.
-
ADMINLTE_GRAVATAR_RATING
¶ (str) Gravatar image rating.
Valid values are:
'g'
,'pg'
,'r'
,'x'
.Defaults to
'pg'
.
HTML¶
-
ADMINLTE_USE_SHIM
¶ (bool) Toggle to use HTML5 Shim for IE9 support.
Defaults to
False
.
-
ADMINLTE_HTML_LANG_BIDI
¶ (str) HTML
dir
attribute value for handling bidirectional text.Valid values are
'ltr'
,'rtl'
,'auto'
.Defaults to
'ltr'
.
Page Title¶
Settings to customize template tag {% page_title %}
output.
Please check the Template Tags > Tags section for more information on {% page_title %}
.
-
ADMINLTE_TITLE_FORMAT
¶ (str) Page title string format.
Supported string format parameters are:
- site: Site name
- divider: Divider character between the site name and current page name
- page: Current page name
Defaults to
'{site} {divider} {page}'
.
-
ADMINLTE_TITLE_FORMAT_PAGINATION
¶ (str) Page title string format for pages with pagination (ListView, etc.)
Supported string format parameters are:
- site: Site name
- divider: Divider character between the site name and current page name
- page: Current page name
- curr_no: Current page number
- last_no: Last page number
Defaults to
'{site} {divider} {page} ({curr_no} of {last_no})'
.
-
ADMINLTE_TITLE_SITE
¶ (str) Page title site name text.
Defaults to
'AdminLTE'
.
-
ADMINLTE_TITLE_DIVIDER
¶ (str) Page title divider for page name and site name.
Defaults to
'|'
.
Static¶
-
ADMINLTE_STATIC_ENABLE_DATATABLES
¶ (bool) Toggle to enable the Datatables library (https://www.datatables.net/) included out-of-the-box.
Defaults to
True
.
-
ADMINLTE_STATIC_ENABLE_FONTAWESOME
¶ (bool) Toggle to enable the Font Awesome library (https://fontawesome.com/v4.7.0/icons/) included out-of-the-box.
Defaults to
True
.
-
ADMINLTE_STATIC_ENABLE_SELECT2
¶ (bool) Toggle to enable the Select2 library (https://select2.org/) included out-of-the-box.
Defaults to
True
.
Theme¶
-
ADMINLTE_SKIN_STYLE
¶ (str) Default AdminLTE skin style.
Valid values are:
'skin-black'
,'skin-black-light'
,'skin-blue'
,'skin-blue-light'
,'skin-green'
,'skin-green-light'
,'skin-purple'
,'skin-purple-light'
,'skin-red'
,'skin-red-light'
,'skin-yellow'
,'skin-yellow-light'
.Defaults to
'skin-blue'
.
-
ADMINLTE_CONTROL_STYLE
¶ (str) Default AdminLTE control sidebar style.
Valid values are:
'control-sidebar-dark'
,'control-sidebar-light'
.Defaults to
'control-sidebar-dark'
.
Changelog¶
1.4.0 (Sep-17-2020)¶
- Updated documentation. Added changelog page.
- Updated example project
example_project
- Added optional Django Admin custom AdminLTE2 theme (add
adminlte2_admin
toINSTALLED_APPS
) - Pages
- Login
- Updated login form template texts from
Login
toLog In
- Added template block
{% block message_template %}
to accommodate Djangomessages
- Added new login form-specific template blocks
{% block login_custom_messages %}
,{% block login_form_non_field_errors %}
,{% block login_form_fields %}
,{% block login_form_buttons %}
,{% block login_form_action %}
,{% block login_form_id %}
, and{% block login_form_method %}
- Updated login form template texts from
- Register
- Fixed HTML element
<p class="login-box-msg">
to<p class="register-box-msg">
- Updated register form template submit button text from
Submit
toRegister
- Added template block
{% block message_template %}
to accommodate Djangomessages
- Added new register form-specific template blocks
{% block register_custom_messages %}
,{% block register_form_non_field_errors %}
,{% block register_form_fields %}
,{% block register_form_buttons %}
,{% block register_form_action %}
,{% block register_form_id %}
, and{% block register_form_method %}
- Fixed HTML element
- Template tags
- Added new template tag
{% add_attr %}
that adds attribute name values to Django template form fields
- Added new template tag
1.3.2 (May-27-2020)¶
- Fixed template tag
{% gravatar_url %}
to add the Gravatarf
URL parameter only ifforce_default
isTrue
- Updated template tag
{% add_active %}
to support raw URL string
1.3.1 (May-16-2020)¶
- Updated
adminlte2/fix/header_dropdown_link_color.css
to support mobile view and top navigation left header items - Updated example project
example_project
1.3.0 (May-15-2020)¶
- Updated example project
example_project
- Deployed a live version of the example project at https://djangoadminlte2templates.pythonanywhere.com
- Layouts
- New component layout template
adminlte2/components/footer_top_navigation.html
for top navigation footer
- New component layout template
- Static files
- Updated
jQuery
version from3.4.1
to3.5.1
- Added
DataTables 1.10.21
andSelect2 4.0.13
- Added custom CSS
fix/header_dropdown_link_color.css
to fix header dropdown link colors
- Updated
- Settings
- Added new settings
ADMINLTE_HTML_LANG_BIDI
to manage<html>
dir
attribute value for handling bidirectional text - Added new settings
ADMINLTE_FOOTER_VERSION
to manage the footer version text - Added new settings
ADMINLTE_STATIC_ENABLE_DATATABLES
,ADMINLTE_STATIC_ENABLE_FONTAWESOME
,ADMINLTE_STATIC_ENABLE_SELECT2
to manage the enabling of these optional static files - Added new settings
ADMINLTE_CDN_DATATABLES_CSS_CORE
,ADMINLTE_CDN_DATATABLES_JS_CORE
to manage DataTables’ CDN links - Added new settings
ADMINLTE_CDN_SELECT2_CSS_CORE
,ADMINLTE_CDN_SELECT2_JS_CORE
to manage Select2’s CDN links
- Added new settings
- Template tags
- Fixed ‘sites’ framework support for {% page_title %} template tag
- Updated {% gravatar_url %} template tag:
{% gravatar_url %}
now returns aTemplateSyntaxError
exception if any of thesize
,default
, andrating
parameters is not of valid value- Returned URL string is now enclosed in
mark_safe()
, disabling string auto escape
- Updated {% paginator %} template tag:
adjacent_pages
parameter is now strictly applied to the left and right side of the current page link{% paginator %}
now returns aTemplateSyntaxError
exception if thealign
parameter is not of valid value.- Added new template block
{% paginator_id %}
for the paginator <ul> elementid
attribute, defaults to"pagination"
- Paginator
<ul>
element is now enclosed in a<nav>
tag instead of<div>
- Template blocks
- Added new block
extra_head
in base template for adding HTML tags in<head>
- Added new block
html_lang_bidi
in base template for managing<html>
dir
attribute - Added new block
paginator_id
inextras/paginator.html
for managing the paginator elementid
attribute - Added new block
stylesheets_fix
in base template for custom CSS fixes
- Added new block
- Build
- Added unit tests for custom template tags and filters, context processors, and template files
- Added ESLint configuration file
- Added StyleLint configuration file
- Added coverage.py configuration file
- Added tox configuration file
- Added Codecov integration for code coverage
- Added CodeFactor.io integration for code quality
- Added Travis CI integration for continuous integration
1.2.0 (Apr-19-2020)¶
- Updated
{% block login_logo_href %}
and{% block register_logo_href %}
default value to/
- Updated example Django project
example_project
- Added new
Shortcuts
layout template``no_breadcrumbs_footer/*`` that removes footer component and breadcrumb navigation - Added new template tag
{% page_title %}
that generates text for HTML<title>
1.1.0 (Apr-13-2020)¶
- Fixed code to support Python 2.7 and <=Django 1.11
- Updated
adminlte2/layouts/login.html
to work out-of-the-box with LoginView - Updated
adminlte2/layouts/register.html
to work out-of-the-box with UserCreationForm - Updated setting
ADMINLTE_HTML_LANG
to base its default value from Django settingLANGUAGE_CODE
- Added new template filter
add_class
that adds class name values to Django template form fields - Added new template tag
{% gravatar_url %}
that generates a Gravatar image URL based on current user details - Added new template tag
{% paginator %}
that generates an HTML code block forListView
pagination - Added new settings
ADMINLTE_GRAVATAR_SIZE
,ADMINLTE_GRAVATAR_DEFAULT
,ADMINLTE_GRAVATAR_FORCE_DEFAULT
,ADMINLTE_GRAVATAR_RATING