pip install django-simpleui
INSTALLED_APPS = [
'simpleui',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
...
]
pip install django-simpleui --upgrade
SIMPLEUI_LOGO = 'https://inhami.com/static/images/taro-48.png'
admin.site.site_header = '芋圆社区后台管理'
admin.site.site_title = '芋圆社区后台管理'
SIMPLEUI_HOME_INFO = False
SIMPLEUI_HOME_QUICK = False
SIMPLEUI_HOME_ACTION = False
SIMPLEUI_LOADING = False
class Meta:
verbose_name = '用户'
verbose_name_plural = verbose_name
ordering = ['id']
http://127.0.0.1:8000/admin/#/admin/townbase/user/
SIMPLEUI_CONFIG = {
'system_keep': False,
'menu_display': ['用户'], # 开启排序和过滤功能, 不填此字段为默认排序和全部显示, 空列表[] 为全部不显示.
'dynamic': True, # 设置是否开启动态菜单, 默认为False. 如果开启, 则会在每次用户登陆时动态展示菜单内容
'menus': [
{
'name': '用户',
'icon': 'fa fa-file',
'models': [{
'name': '用户',
'url': '/admin/townbase/user/',
'icon': 'fab fa-github'
}]
}]
}
from django.contrib import admin
from .models import *
class AnimeAdmin(admin.ModelAdmin):
admin.site.register(Anime, AnimeAdmin)
list_per_page = 500
list_display = ['name', 'role', 'type', 'rank', 'num', 'allNum', 'times', 'date', 'tag']
# townbase-models.py
# 追番
class Anime(models.Model):
name = models.CharField(max_length=40, verbose_name='名称')
image = models.ImageField(upload_to='anime/%Y%m%d/', blank=True, verbose_name='图片')
introduce = models.TextField(max_length=1000, verbose_name='备注')
type = models.CharField(max_length=20, verbose_name='类型')
rank = models.FloatField(verbose_name='评分')
date = models.DateField(verbose_name='时间')
role = models.CharField(max_length=40, verbose_name='主角')
num = models.PositiveIntegerField(default=0, verbose_name='观看集数')
allNum = models.PositiveIntegerField(default=0, verbose_name='总集数')
times = models.PositiveIntegerField(default=0, verbose_name='次数')
tag = models.PositiveIntegerField(default=0, verbose_name='标签')
class Meta:
verbose_name_plural = u'追番'
def __str__(self):
return self.name
list_display_links = ['name']
list_editable = ['role', 'type', 'rank', 'num', 'allNum', 'times', 'date', 'tag']
search_fields = ['name']
list_filter = ['type', 'times']
# coding=UTF-8
from django.contrib import admin
from .models import *
# 之前上面的修改header,title的代码写在这里
admin.site.site_header = '芋圆社区后台管理'
admin.site.site_title = '芋圆社区后台管理'
class AnimeAdmin(admin.ModelAdmin):
list_per_page = 100
search_fields = ['name']
list_filter = ['type', 'times']
list_editable = ['role', 'type', 'rank', 'num', 'allNum', 'times', 'date', 'tag']
list_display = ['name', 'role', 'type', 'rank', 'num', 'allNum', 'times', 'date', 'tag']
admin.site.register(Anime, AnimeAdmin)
此页面不支持夜间模式!
已进入夜间模式!
已进入普通模式!
搜索框不允许为空
签到成功!经验+5!芋圆币+2!
签到失败!今日已签到!
需要登录社区账号才可以进入!