Django AdminLTE 2 Documentation

Similar documents
django-amp-tools Documentation Release latest

django-baton Documentation

django-baton Documentation

django-oscar-paypal Documentation

Markup Language. Made up of elements Elements create a document tree

django-avatar Documentation

django-avatar Documentation

Building beautiful websites with Bootstrap: A case study. by Michael Kennedy michaelckennedy.net

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

CSS Mapping in Advanced Mode for Events. Cvent, Inc 1765 Greensboro Station Place McLean, VA

CSCI 1320 Creating Modern Web Applications. Content Management Systems

CUSTOMER PORTAL. Custom HTML splashpage Guide

Web Programming and Design. MPT Senior Cycle Tutor: Tamara Week 1

Chapter 7 BMIS335 Web Design & Development

CSS (Cascading Style Sheets)

Understanding this structure is pretty straightforward, but nonetheless crucial to working with HTML, CSS, and JavaScript.

AGENDA. EMBEDDING FONTS [ Font Files & CSS font-family ] :: Online Font Converter :: ADD font-family css code to style.css

Bambu Bootstrap Documentation

Front-End UI: Bootstrap

Important installation note Back to Top. Homepage Overview Back to Top

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

AGENDA. HTML CODING YOUR HOMEPAGE [ Part IV ] :: NAVIGATION <nav> :: CSS CODING FOR HOMEPAGE [ <nav> & child elements ] CLASS :: 13.

my6docs Documentation

alphafilter Documentation

Quick.JS Documentation

AGENDA. :: Add Meta Tag for Viewport (inside of head element): :: Add Script that renders HTML5 elements for older versions of Internet Explorer

Mobile Web Applications. Gary Dubuque IT Research Architect Department of Revenue

Mateen Eslamy 10/31/13

Introduction to WEB PROGRAMMING

Challenge: Working with the MIS2402 Template

HTML Organizing Page Content

Create a three column layout using CSS, divs and floating

Review of HTML. Chapter Pearson. Fundamentals of Web Development. Randy Connolly and Ricardo Hoar

CSS is applied to an existing HTML web document--both working in tandem to display web pages.

Create First Web Page With Bootstrap

wagtailmenus Documentation

Web Development and HTML. Shan-Hung Wu CS, NTHU

Django Admin Sortable Documentation

Static Webpage Development

Adaptations by PVII responsive and then creates your page instantly Al Sparber & Gerry Jacobsen PVII

Css Manually Highlight Current Link Nav Link

Hyper Text Markup Language

As we design and build out our HTML pages, there are some basics that we may follow for each page, site, and application.

Sitecore Experience Accelerator 1.1 Rev: September 13, Sitecore Experience Accelerator 1.1

Web development using PHP & MySQL with HTML5, CSS, JavaScript

django-sekizai Documentation

MPT Web Design. Week 1: Introduction to HTML and Web Design

Django PAM Documentation

Nuit Documentation. Release Ben Cardy

Djam Documentation. Release Participatory Culture Foundation

django-ad-code Documentation

TailorDev Contact Documentation

BLOG Magento Extension by PIXLOGIX USER GUIDE Copyright Pixlogix.com All rights reserved

wagtailmenus Documentation

Thanks for buying the Advanced Color Swatches Extension for Magento. 1. Drop the app-js-skin folders in your magento installation folder.

BA. (Hons) Graphics Design

COMP519 Web Programming Lecture 3: HTML (HTLM5 Elements: Part 1) Handouts

Hyper Text Markup Language

AGENDA :: MULTIMEDIA TOOLS :: CLASS NOTES. INSTALLING FONTS :: Download, Install, & Embed Your Fonts. LECTURE :: Responsive Web Design [RWD]

Getting Started with CSS Sculptor 3

django-osm-field Release 0.3.1

,.., «..»

Sitecore Experience Accelerator 1.2 Rev: September 13, Sitecore Experience Accelerator 1.2

CST272 Getting Started Page 1

Siteforce Pilot: Best Practices

Bluehost and WordPress

Virto SharePoint Forms Designer for Office 365. Installation and User Guide

WEB/DEVICE DEVELOPMENT CLIENT SIDE MIS/CIT 310

Tabs within Divi Theme Options include: Table of Contents. Divi Theme Options... 1 General Tab... 2 Navigation Tab... 6

Web Software Model CS 4640 Programming Languages for Web Applications

Django Forme Documentation

Drupal 8 / Theming Quickstart

IEEE Wordpress Theme Documentation

WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5

The Structure of the Web. Jim and Matthew

Default Page Dimensions in pixels

Cascading Style Sheet

web-sockets-homework Directions

Using CSS for page layout

Product Page PDF Magento 2 Extension

SagePay payment gateway package for django-oscar Documentation

Accessibility of EPiServer s Sample Templates

Dreamweaver CS3 Lab 2

AGENDA :: MULTIMEDIA TOOLS :: (1382) :: CLASS NOTES

Responsive web design (RWD) CSS3 Media queries. Mobile vs desktop web sites. Web Development 1 CS1115/CS5002

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

JavaScript: Objects, BOM, and DOM CS 4640 Programming Languages for Web Applications

Block & Inline Elements

All Adobe Digital Design Vocabulary Absolute Div Tag Allows you to place any page element exactly where you want it Absolute Link Includes the

Red Hat 3scale 2.2 Billing

Product Page PDF Magento Extension

Cascading Style Sheets Level 2

MIT AITI Python Software Development Lab DJ1:

v1.0.3 WILD SKIN A PROBOARDS V5 THEME

Lab 1: Introducing HTML5 and CSS3

HTML TIPS FOR DESIGNING.

USER MANUAL ADVANCE SHOP BY BRAND TABLE OF CONTENTS. Version: 1.0.4

A Quick Introduction to the Genesis Framework for WordPress. How to Install the Genesis Framework (and a Child Theme)

Ace Corporate Documentation

HTML Organizing Page Content

Transcription:

Django AdminLTE 2 Documentation Release 0.1 Adam Charnock Jul 02, 2018

Contents 1 Contents 3 1.1 Quickstart................................................ 3 1.2 Templates & Blocks Reference..................................... 4 1.3 Templates & Blocks Reference..................................... 15 2 Credits 17 3 Indices and tables 19 i

ii

Django AdminLTE2 provides extensible templates for making use of the general purpose AdminLTE2 theme. Contents 1

2 Contents

CHAPTER 1 Contents 1.1 Quickstart Install the pip package: pip install django-adminlte2 Add the apps to INSTALLED_APPS: INSTALLED_APPS = [ # Any apps which will override adminlte's templates (i.e. your apps)... # The general purpose templates 'django_adminlte', # Optional: Skin for the admin interface 'django_adminlte_theme', ] # Any apps which need to have their templates overridden by adminlte 'django.contrib.admin',... Important: Take note of the ordering of INSTALLED_APPS. If you find templates are not being found & used as expected it is probably due to a problem here. Django looks for a template in the order in which apps are listed in INSTALLED_APPS, hence the ordering above. If you only wish to skin the admin interface, you can stop here. Your admin interface should now be displaying with the AdminLTE theme. 3

You can also make use of the AdminLTE theme for your app. This may be particularly useful for internal (non-public) apps which need a quick and effective layout. 1.1.1 Using the templates in your app The base AdminLTE template provides much of what you need, but you ll need to customise it in some ways to meet your needs. In particular, no navigation is provided (we ll cover this shortly). To add & modify the functionality of the base template you should create your own base template. This template should extend adminlte/base.html. Several blocks are available for you to extend. {% extends 'adminlte/base.html' %} {% block title %}My App {% block content %} Just some example content Take a look at the base template to see the available blocks. 1.1.2 Adding navigation The base template includes a number of other templates in order to create the whole. For example, the sidebar navigation resides in adminlte/lib/_main_sidebar.html. To customise this template you should create a template of the same path & name in your app s templates folder. Important: Your app(s) must be listed before django_adminlte2 in INSTALLED_APPS. Otherwise Django will find the default default provided by django-adminlte2 before your customised one. In your own app create the template adminlte/lib/_main_sidebar.html: {% extends 'adminlte/lib/_main_sidebar.html' %} {% block nav_links %} <li> <a href="/some/url"> <i class="fa fa-dashboard"></i> <span>home</span> </a> </li> <li> <a href="/some/url"> <i class="fa fa-user"></i> <span>users</span> </a> </li> {% endblock nav_links %} You should now find the navigation has updated. 1.2 Templates & Blocks Reference 4 Chapter 1. Contents

Contents Templates & Blocks Reference Base templates * adminlte/base.html Commonly used blocks Block reference title_outer title meta stylesheets extra_head body_class nav_header nav_sidebar content_wrapper content_header page_name page_description no_description page_actions breadcrumbs content_outer messages content_block_wrap content nav_footer javascript extra_foot body * adminlte/login.html Block reference logo logo_text logo_href login_form 1.2. Templates & Blocks Reference 5

login_form_links Include templates * adminlte/lib/_main_sidebar.html Block Reference user_panel form nav_links nav_links_ul nav_links_outer * adminlte/lib/_main_header.html Block Reference logo logo_href logo_text logo_text_small nav_bar nav_bar_center header_dropdowns user_header menu_footer change_password_url logout_url * adminlte/lib/_main_footer.html Block Reference footer_right version footer_left legal Below you will find reference for each available template, and the blocks that can be overridden. Note than when overriding some blocks it may make sense to make use of {{ block.super }} (inheritance docs). 1.2.1 Base templates adminlte/base.html The primary base template which provides a sidebar, top navigation with user information, and footer. 6 Chapter 1. Contents

Commonly used blocks title page_name page_description content stylesheets javascript Block reference title_outer Wrapper around the the outside of the <title> tag. Default: {% block title_outer %} <title>{% block title %}{{ site.name }}</title> title Contents of the pages <title> tag. Default: <title>{% block title %}{{ site.name }}</title> This will set a sensible default if the site variable references the current site object (from Django s sites framework) meta All <meta> tags which appear in the pages <head>. Default: {% block meta %} <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> Consider making use of {{ block.super }} when overriding this block. stylesheets All <style> tags which appear in the pages <head>. By default this includes all content from adminlte/lib/_styles.html. Consider making use of {{ block.super }} when overriding this block. 1.2. Templates & Blocks Reference 7

extra_head Additional HTML to be placed before the </head> tag. Empty by default. body_class Additional CSS classes which can be placed into the <body> tag s class attribute. nav_header Wrapper around the entirety of the main header. Default: {% block nav_header %} {% include 'adminlte/lib/_main_header.html' %} If you wish to customise the entirety of the main header you may override this block, otherwise you can redefine adminlte/lib/_main_header.html to get finer control over your changes. nav_sidebar Wrapper around the entirety of the sidebar. Default: {% block nav_sidebar %} {% include 'adminlte/lib/_main_sidebar.html' %} If you wish to customise the entirety of the sidebar you may override this block, otherwise you can redefine adminlte/lib/_main_header.html to get finer control over your changes. content_wrapper Wrapper around all of the content area (including the content header, messages, and actual page content). You probably want to override the content block instead. content_header The header that appears over the page content, but within the content area of the design. Default: {% block content_header %} <section class="content-header"> <h1> {% block page_name %} {% block no_description %} <small>{% block page_description %}</small> </h1> {% block breadcrumbs %} (continues on next page) 8 Chapter 1. Contents

{# Breadcrumb implementation left to developers #} </section> (continued from previous page) page_name The name of the page as will be displayed in the content header. page_description The description of the page tht will appear alongside the page name in the header. no_description If no description is to be displayed, you can implement this as an empty block to remove the wrapper HTML. For example: {% block no_description %} page_actions Generally used to display actions/buttons relevant to the current page. For example: {% block page_actions %} <a href="{% url 'alerts:create' %}" class="btn btn-success btn-sm"> Create new</a> breadcrumbs Use the block the implement your breadcrumbs if desired. Todo: Provide tools to make the generation of breadcrumbs easier content_outer Wraps the outside of the content area and any messages. You probably want to override the content block instead. 1.2. Templates & Blocks Reference 9

messages Wrapper around the entirety of the message area. Default: {% block messages %} {% include 'adminlte/lib/_messages.html' %} See the Django messages framework. content_block_wrap Wraps the content block. May be useful in some cases. content Block for the main content which will be displayed in the page. Empty by default. nav_footer Wrapper around the entirety of the main footer. Default: {% block nav_footer %} {% include 'adminlte/lib/_main_footer.html' %} If you wish to customise the entirety of the main footer you may override this block, otherwise you can redefine adminlte/lib/_main_footer.html to get finer control over your changes. javascript All <script> tags which appear before the </body> tag. By default this includes all content from adminlte/lib/_scripts.html. Consider making use of {{ block.super }} when overriding this block. extra_foot Additional HTML to be placed before the </body> tag. Empty by default. body Wraps the entire contents of the body tag, excluding the javascript and extra_foot blocks. Define if you wish to replace the entire body of the page 10 Chapter 1. Contents

adminlte/login.html Base template for a login interface. This excludes the navigational elements which are usually present. Example: {% extends "adminlte/login.html" %} {% block form %} <form method="post"> {% csrf_token %} {{ form }} </form> Block reference The login form defines some blocks in addition to those available on adminlte/base.html. logo Wraps the logo section of the login page. Default: {% block logo %} <div class="login-logo"> <a href="{% block logo_href %}/">{% block logo_text %}<b> Admin</b>LTE</a> </div> logo_text The name of the site as shown above the login form. Default: {% block logo_text %}<b>admin</b>lte logo_href URL the logo should link to. Default: / login_form The form to be displayed. Defaults to a static HTML form. login_form_links Show to the left of the login button. A useful place for a forgotten password link. 1.2. Templates & Blocks Reference 11

1.2.2 Include templates Much of the HTML rendering is done in included template files. These files reside in adminlte/lib/. The easiest way to do this is to create a file of the same path and name in your app s templates folder. This new template can then extend the original template and tweak blocks as necessary (or, if you wish, forgo the extending the reimplement the entire template). Here is an example of the overriding and extension. We will be overriding the sidebar template (adminlte/lib/ _main_sidebar.html), so we ll create a template called my_app_name/templates/adminlte/lib/ _main_sidebar.html: {% extends 'adminlte/lib/_main_sidebar.html' %} {% block nav_links %} <li> <a href="/some/url"> <i class="fa fa-dashboard"></i> <span>home</span> </a> </li> <li> <a href="/some/url"> <i class="fa fa-user"></i> <span>users</span> </a> </li> {% endblock nav_links %} adminlte/lib/_main_sidebar.html Renders the sidebar navigation. You ll likely need to implement this template at a minimum. Block Reference user_panel Wraps the user details panel form An empty tag where you may wish to include a form. The AdminLTE examples place a search box here. nav_links Renders the <li> elements for the navigation. See above for an example. nav_links_ul Wrapper around the entire <ul> element containing the navigation. You probably want to use nav_links. 12 Chapter 1. Contents

nav_links_outer Wrapper within the <ul> element around all <li> elements. You probably want to use nav_links. adminlte/lib/_main_header.html Renders the header. Contains the site name and details regarding the currently logged in user. Block Reference logo Wraps the logo HTML. Default: {% block logo %} <a href="{% block logo_href %}/" class="logo"> <!-- mini logo for sidebar mini 50x50 pixels --> <span class="logo-mini"><b>on</b>ly</span> <!-- logo for regular state and mobile devices --> <span class="logo-lg"><b>only</b>admin</span> </a> logo_href URL the logo should link to. Default: / logo_text The name of the site as shown in the header. Default: {% block logo_text %}<b>admin</b>lte logo_text_small The logo name of the site as show in the header (used on narrow/mobile screens). Default: {% block logo_text_small %}<b>a</b>lte nav_bar The entirety of the header navigation 1.2. Templates & Blocks Reference 13

nav_bar_center An empty block in the center of the main nav bar. header_dropdowns The dropdown menus in the header. user_header The contents of the user dropdown in the header. Default: {% block user_header %} <li class="user-header"> <img src="{% avatar_url size=180 %}" class="img-circle" alt="user Image"> <p> {% firstof request.user.get_short_name request.user.get_username %} <small>member since {{ request.user.date_joined }}</small> </p> </li> menu_footer The footer of the user dropdown. Normally used for actions such as Change password and logout. Default: {% block menu_footer %} <li class="user-footer"> <div class="pull-left"> <a href="{% block change_password_url %}{% url 'admin:password_change ' %}" class="btn btn-default btn-flat">{% trans 'Change password' %}</a> </div> <div class="pull-right"> <a href="{% block logout_url %}{% logout_url %}" class= "btn btn-default btn-flat">sign out</a> </div> </li> change_password_url The URL to the change password interface (defaults to Django admin s change password page) logout_url The URL used for logging out the current user. Defaults to the value given in the LOGOUT_URL setting, or /logout if not set. 14 Chapter 1. Contents

adminlte/lib/_main_footer.html Renders the footer containing (by default) a legal notice and software version. Default footer content: <footer class="main-footer"> <div class="pull-right hidden-xs"> {% block footer_right %} <b>version</b> {% block version %}0.1 </div> {% block footer_left %} {% block legal %} <strong>copyright {% now "Y" %}{% if not site %}.{% endif %} {% if site %} <a href="http://{{ site.domain }}">{{ site.name }}</a> {% endif %} </strong> All rights reserved. </footer> Block Reference footer_right Content to be displayed on the right of the footer. See above for default. version The current version of the software. Shown in footer_right by default. footer_left The left hand content of the footer. Contains only legal by default. legal Legal notice. Will include a copyright notice referencing the current date and site name (if present). 1.3 Templates & Blocks Reference Contents Templates & Blocks Reference 1.3. Templates & Blocks Reference 15

{% add_active %} {% avatar_url %} {% logout_url %} Some utility template tags are provided which you may find useful. 1.3.1 {% add_active %} Returns the string " active " if the current url matches the one provided. You may find this useful in your lib/ _main_sidebar.html template. Example: <li class="{% add_active 'myapp:detail' object.pk %}"> <a href="{% url 'myapp:detail' object.pk %}">Details</a> </li> This will normally match any URL which starts with the provided value. Therefore the active class will be applied for child pages too. You can also specify the exact_only parameter which will override this behaviour. This is often useful for the home page: <li class="{% add_active 'myapp:home' exact_match=true %}"> <a href="{% url 'myapp:home' %}">Home</a> </li> 1.3.2 {% avatar_url %} Used in the based templates to find an avatar for the current user (uses Gravatar). 1.3.3 {% logout_url %} Used in the based templates to determine the default logout url by looking for the LOGOUT_URL setting. 16 Chapter 1. Contents

CHAPTER 2 Credits This project a based heavily on work by the following: dnaextrim for django_adminlte_x beastbikes for django-adminlte 17

18 Chapter 2. Credits

CHAPTER 3 Indices and tables genindex modindex search 19