Django AdminLTE2 && AdminLTE3

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

Django AdminLTE3 provides the functionality of the AdminLTE3 theme to developers in the form of standard base templates. Optional styling for Django’s built-in admin interface is also provided.

使用三部曲

安装:

# adminlte2
pip install django-adminlte2

# adminlte3
pip install django-adminlte3

注册:

# adminlte2
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',  # 可能会出现重复admin的情况 - 注释掉
    ...
]

# adminlte3
INSTALLED_APPS = [
     # General use templates & template tags (should appear first)
    'adminlte3',
     # Optional: Django admin theme (must be before django.contrib.admin)
    'adminlte3_theme',
    ...
]

使用:

// adminlte2、adminlte3
{% extends 'adminlte/base.html' %}

{% block title %}{{ site }}{% endblock %}
{% block content %}
    Just some example content - {{ site }}
    <div>{{ docs }}</div>
{% endblock %}

效果展示

AdminLTE2
AdminLTE3

优点👍

在快速搭建中省去了环境配置的时间(static),尤其是一些以测试为目的的项目,只专注界面要求、功能实现即可。

文档

AdminLTE2
AdminLTE3

posted @ 2021-03-21 01:26  cnpy  阅读(1236)  评论(0)    收藏  举报