• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

MaistrenkoAnton/django-material-admin: Material design for django administration

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

MaistrenkoAnton/django-material-admin

开源软件地址(OpenSource Url):

https://github.com/MaistrenkoAnton/django-material-admin

开源编程语言(OpenSource Language):

HTML 29.5%

开源软件介绍(OpenSource Introduction):

pypi python django

Django Material Administration

https://raw.githubusercontent.com/MaistrenkoAnton/django-material-admin/master/app/demo/screens/login.png

Quick start

pip install django-material-admin

  1. Add material.admin and material.admin.default to your INSTALLED_APPS setting instead of django.contrib.admin:
  • required
INSTALLED_APPS = (
    'material',
    'material.admin',

    'django.contrib.auth',
    ...
)
  1. Include the material templates URLconf in your project urls.py like this:
  • required
from django.contrib import admin
from django.urls import path

urlpatterns = [
    path('admin/', admin.site.urls),
]
  1. Register your models in admin.py.
from django.contrib.admin import ModelAdmin, register


from persons.models import Person

@register(Person)
class PersonAdmin(ModelAdmin):
    list_display = ('name', 'first_name', 'last_name')
  1. Add icon to the application in app.py and specify the app usage in __init__.py
https://materializecss.com/icons.html
  • optional

__init.py__

default_app_config = 'persons.apps.PersonsConfig'

apps.py

from django.apps import AppConfig


class PersonsConfig(AppConfig):
    name = 'persons'
    icon_name = 'person'
  1. Add icon to the MaterialModelAdmin in admin.py

Material icon's name sources:

https://materializecss.com/icons.html

https://material.io/resources/icons/?style=baseline

  • optional
from django.contrib.admin import ModelAdmin, register

from persons.models import Person


@register(Person)
class MaterialPersonAdmin(ModelAdmin):
    icon_name = 'person'
  1. Add Admin site configurations to settings.py file:
  • optional

MATERIAL_ADMIN_SITE = {
    'HEADER':  _('Your site header'),  # Admin site header
    'TITLE':  _('Your site title'),  # Admin site title
    'FAVICON':  'path/to/favicon',  # Admin site favicon (path to static should be specified)
    'MAIN_BG_COLOR':  'color',  # Admin site main color, css color should be specified
    'MAIN_HOVER_COLOR':  'color',  # Admin site main hover color, css color should be specified
    'PROFILE_PICTURE':  'path/to/image',  # Admin site profile picture (path to static should be specified)
    'PROFILE_BG':  'path/to/image',  # Admin site profile background (path to static should be specified)
    'LOGIN_LOGO':  'path/to/image',  # Admin site logo on login page (path to static should be specified)
    'LOGOUT_BG':  'path/to/image',  # Admin site background on login/logout pages (path to static should be specified)
    'SHOW_THEMES':  True,  #  Show default admin themes button
    'TRAY_REVERSE': True,  # Hide object-tools and additional-submit-line by default
    'NAVBAR_REVERSE': True,  # Hide side navbar by default
    'SHOW_COUNTS': True, # Show instances counts for each model
    'APP_ICONS': {  # Set icons for applications(lowercase), including 3rd party apps, {'application_name': 'material_icon_name', ...}
        'sites': 'send',
    },
    'MODEL_ICONS': {  # Set icons for models(lowercase), including 3rd party models, {'model_name': 'material_icon_name', ...}
        'site': 'contact_mail',
    }
}

video lessons:

  • PySchool
https://raw.githubusercontent.com/MaistrenkoAnton/django-material-admin/master/app/demo/screens/pyself.png

Video instructions



  • Install Django
https://raw.githubusercontent.com/MaistrenkoAnton/django-material-admin/master/app/demo/screens/material1.png


  • Install Django-material-admin
https://raw.githubusercontent.com/MaistrenkoAnton/django-material-admin/master/app/demo/screens/material2.png


  • Register models for material administration interface
https://raw.githubusercontent.com/MaistrenkoAnton/django-material-admin/master/app/demo/screens/material3.png


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap