Templates
General
The main purpose of the Django-AdminLTE2-PDQ package is to streamline the creation of Django sites, using the AdminLTE2 theme.
As such, this package comes with many templates that are used right out of the box and an automagically-customized site look and feel, just by following the minimal steps as described in Quickstart.
All of these templates can be overridden to further customize the look and feel of the site, depending on project needs. Rather than listing out every single file and every single block within those files that can be overridden, it is preferable that you just reference the files yourself. The files can be found on GitHub.
Important
In settings.py
, if you are using
APP_DIRS
to override templates, you must ensure that the app you are using to house
those templates is listed in the
INSTALLED_APPS
setting before the django-adminlte2-pdq app. Additionally, the
django-adminlte2-pdq app should be listed before any Django apps.
Example Customization
To show just how easy it can be to use and customize templates in the Django-AdminLTE2-PDQ package, we can show an example. The following three steps document customizing the login page social links section.
First, we can see what this page looks like by default:
To change this page, we can create a template to override the original behavior:
Create
registration/login.html
in one of your Django project’s template folders, defined via the project settings file.Extend the packages default
registration/login.html
by adding the following line:{% extends "registration/login.html" %}
Override the
social_auth_links
block. An empty block will remove the original content. Alternatively, a block with content will replace the original content.Example of “Social Link” Section Removal
{% block social_auth_links %}{% endblock social_auth_links %}
Example of “Social Link” Section Replacement
{% block social_auth_links %} <div class="social-auth-links text-center"> <p>- OR -</p> <a href="#" class="btn btn-block btn-social btn-github btn-flat"> <i class="fa fa-github"></i> Sign in using Github </a> </div> {% endblock social_auth_links %}
Reminder to reference the GitHub files to see all possible package templates that can be overridden.