A Django app that takes all of the work out of making a beautiful and functional web application pretty darn quickly (PDQ) using the AdminLTE2 theme.
Project description
Django-AdminLTE2-PDQ
Django-AdminLTE2-PDQ is a Django app that takes all of the work out of making a beautiful and functional web application pretty darn quickly (PDQ) using the AdminLTE2 theme.
Additionally, the app provides decorators, mixins, template filters, and template tags to aid in the rapid development of a site.
Features include:
- Styled with AdminLTE2.
- Easy sidebar menu creation.
- Automatic Django Admin styling that matches AdminLTE2.
- Automatic inclusion of Admin links in the sidebar.
- Automatic menu link hiding based on user permissions to views.
- Template filters to aid in manual styling.
- Template tags for form rendering that matches AdminLTE2.
- Automatic form error and message styling.
- Font Awesome 4 & Font Awesome 5 integration.
- Highly configurable functionality, via project Django settings variables.
The full documentation can be found on Read The Docs.
Quickstart
-
Install the Django App via GitHub for now. Working on getting on Pypi soon.
python -m pip install django-adminlte2-pdq
-
Add "adminlte2_pdq" to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ 'adminlte2_pdq', ... ]
:information_source: NOTE The adminlte2_pdq app should be listed before any Django apps so that template overriding works correctly. Additionally, if you plan to override any Django-AdminLTE2-PDQ templates, the apps containing those templates should be listed above the adminlte2_pdq app.
-
Django-AdminLTE2-PDQ provides a middleware that is required for some of the available authentication and authorization scenarios from this package to function.
Add this middleware to your middleware list in
settings.py
.Once installed the available scenarios are controlled by changing settings in your
settings.py
file. For more information about the various scenarios and associated settings refer to the full documentation on Read The Docs.MIDDLEWARE = [ ... 'adminlte2_pdq.middleware.AuthMiddleware', ]
:information_source: NOTE Django-AdminLTE2-PDQ has been configured out of the box to get you set up and running as fast as possible. As a result, the settings surrounding authentication and authorization are not as strict as they could be. We strongly encourage you to read the Authentication and Authorization section on Read The Docs once you get the basics of this package working.
-
Django-AdminLTE2-PDQ provides routes and templates for a home page, some sample pages, and Django's account pages. You can add these default routes to your URLconf if you would like to use them.
:information_source: NOTE Using the included routes and templates requires that your
urlpatterns
has both the routes from the package added as well as theaccounts
routes provided by Django. See sample code below.
:warning: WARNING Opting not to use these default routes requires that you configure the
ADMINLTE2_HOME_ROUTE
setting, as some parts of the default template expect that your site has at minimum, a home page, defined in that setting.
from django.contrib import admin from django.urls import include urlpatterns = [ # Adminlte2 default routes for demo purposes path('', include('adminlte2_pdq.urls')), # Django Account Routes - Styled in AdminLTE2 path('accounts/', include('django.contrib.auth.urls')), # Admin - Styled in Django but hosted in AdminLTE2 layout path('admin/', admin.site.urls), ]
-
Ensure that the login redirect will work.
LOGIN_REDIRECT_URL = 'adminlte2_pdq:home'
:information_source: NOTE Django-AdminLTE2-PDQ does not include a route or templates for
/accounts/profile
which is the default Django Login redirect. Adding the above entry to yoursettings.py
file will allow successful logins to redirect to the default provided home page included in step 4. At least until a proper profile route can be set up.
:warning: WARNING If you are not using the default urls from step 4, we assume that you already know where you would like to have users redirected to on successful login and thus have already done this step with a different value.
-
Update
settings.py
to customize the look and feel of Django-AdminLTE2-PDQ. Common configuration options are listed below in the configuration section.For the full list of configuration options refer to the documentation on Read The Docs.
-
Override templates to further customize the look and feel of Django-AdminLTE2-PDQ.
See the Templates section on Read The Docs for more information.
Configuration
Home
Set the "Home" route for your project. This tells the package where to redirect users when they click a link that is designed to take the user home.
ADMINLTE2_HOME_ROUTE = 'adminlte2_pdq:home'
Set the Logo text for your site. This will be shown in the top left of the top bar when the sidebar is expanded.
ADMINLTE2_LOGO_TEXT = 'My Awesome Site'
Set the small Logo text for your site. This will be shown in the top left of the top bar when the sidebar is collapsed.
ADMINLTE2_LOGO_TEXT_SMALL = 'MAS'
Set the skin class to use for the site. Valid skin classes can be found on the AdminLTE documentation page.
ADMINLTE2_SKIN_CLASS = 'skin-green-light'
Menu
By default, the main navigation (non-admin) menu is not part of the sidebar when
the user is viewing a
Django Admin page
If you would like users to be able to see all of the main nav links regardless
of what page they are on, set this value to True
.
ADMINLTE2_INCLUDE_MAIN_NAV_ON_ADMIN_PAGES = (True/False)
By default, the admin navigation menu is not part of the sidebar when the user
is viewing a main navigation
(non-Django-Admin)
page. If you would like users to be able to see all of the admin nav links
regardless of what page they are on, set this value to True
.
ADMINLTE2_INCLUDE_ADMIN_NAV_ON_MAIN_PAGES = (True/False)
By default, there will be an implicit separator bar rendered between each menu
group.
These groups include: MENU_FIRST, MENU, MENU_LAST, and the
Admin Menu.
More information about these groups can be found on the
Read The Docs Admin page.
If you would like to disable this
separator from being automatically rendered, set this value to False
.
ADMINLTE2_USE_MENU_GROUP_SEPARATOR = (True/False)
This setting is the definition for the main navigation menu. There are a lot of options when creating this menu. See the Read The Docs Menu page for a detailed explanation of how to create this menu and all of the available options that can be used.
ADMINLTE2_MENU = []
Admin
By default, the admin menu sidebar will not have a link to the admin index page.
If you would like to append a link to the admin index page in the sidebar,
set this value to True
.
ADMINLTE2_INCLUDE_ADMIN_HOME_LINK = (True/False)
By default, Django-AdminLTE2-PDQ will put the Apps on the Admin Index page
into AdminLTE Info Boxes. Setting this to True
will change that look
to the traditional Django list view, but still within the main AdminLTE site
styling.
ADMINLTE2_ADMIN_INDEX_USE_APP_LIST = (True/False)
Authorization
Whether all routes will require that users are logged in to access unless the route is added to a Whitelist.
If this setting is set to False, then all routes will be accessible and still visible on the sidebar menu.
If this setting is set to True, then all routes will not be accessible nor will
there be links on the sidebar menu unless the user is logged in or the route is
found in the
ADMINLTE2_LOGIN_EXEMPT_WHITELIST
setting.
ADMINLTE2_USE_LOGIN_REQUIRED = (True/False)
Assuming ADMINLTE2_USE_LOGIN_REQUIRED
is set to True,
this is the list of routes that will be shown on the sidebar menu and
accessible, despite a user not being logged in.
:information_source: NOTE Even though the default value for this list is an empty list, the underlying functionality that this setting is used in has some included routes. They can be seen in the full Documentation. The routes defined in this setting will be appended to that default list.
ADMINLTE2_LOGIN_EXEMPT_WHITELIST = []
Whether routes with no defined permission should be hidden unless added to a Whitelist.
If this setting is set to False, then all routes without defined permissions are still visible on the sidebar menu.
If this setting is set to True, then all routes without defined permissions
are hidden on the sidebar menu unless the route is found in the
ADMINLTE2_STRICT_POLICY_WHITELIST
setting.
ADMINLTE2_USE_STRICT_POLICY = (True/False)
Assuming ADMINLTE2_USE_STRICT_POLICY
is set to True,
this is the list of routes that will be shown on the sidebar menu and
accessible, despite said routes having no defined permission.
ADMINLTE2_STRICT_POLICY_WHITELIST = []
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-adminlte2-pdq-0.1.7.tar.gz
.
File metadata
- Download URL: django-adminlte2-pdq-0.1.7.tar.gz
- Upload date:
- Size: 21.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d9971a43af052b3dd7230672af3dcf0fa87a7185735b4299ede6d6c4896a44d |
|
MD5 | 95d56d0f578fb9c82f2b5113fd6f1dcb |
|
BLAKE2b-256 | 8c5182f7f2f7294e1f95f3ebe5472d3590d2a1cb95ce5a915f2894c22064045c |
File details
Details for the file django_adminlte2_pdq-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: django_adminlte2_pdq-0.1.7-py3-none-any.whl
- Upload date:
- Size: 9.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92a421c631b7878025d0fc461db2162d80b64defeef76300944d05f702f3239b |
|
MD5 | 487df457dcd753a3901ef8064e83830a |
|
BLAKE2b-256 | 507ac1f1814124b474922cef0b411c958f430e06de8e93a25d336f411a405939 |