在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):MaistrenkoAnton/django-material-admin开源软件地址(OpenSource Url):https://github.com/MaistrenkoAnton/django-material-admin开源编程语言(OpenSource Language):HTML 29.5%开源软件介绍(OpenSource Introduction):Django Material AdministrationQuick startpip install django-material-admin
INSTALLED_APPS = (
'material',
'material.admin',
'django.contrib.auth',
...
)
from django.contrib import admin
from django.urls import path
urlpatterns = [
path('admin/', admin.site.urls),
]
from django.contrib.admin import ModelAdmin, register
from persons.models import Person
@register(Person)
class PersonAdmin(ModelAdmin):
list_display = ('name', 'first_name', 'last_name')
__init.py__ default_app_config = 'persons.apps.PersonsConfig' apps.py from django.apps import AppConfig
class PersonsConfig(AppConfig):
name = 'persons'
icon_name = 'person'
Material icon's name sources: https://materializecss.com/icons.html https://material.io/resources/icons/?style=baseline
from django.contrib.admin import ModelAdmin, register
from persons.models import Person
@register(Person)
class MaterialPersonAdmin(ModelAdmin):
icon_name = 'person'
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:
Video instructions
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论