xadmin设置用户里的邮箱验证码图标会影响用户的图标
来源:13-3 model_icon, 只读字段,默认排序设置
caicai31
2018-01-09
# _*_ coding: utf-8 _*_
__author__ = 'cai'
__date__ = '2017/11/11 11:24'
import xadmin
from xadmin import views
from xadmin.plugins.auth import UserAdmin
from xadmin.layout import Main, Side, Fieldset, Row
from django.utils.translation import ugettext as _
from .models import EmailVerifiyRecord
from .models import Banner
class UserProfileAdmin(UserAdmin):
def get_form_layout(self):
if self.org_obj:
self.form_layout = (
Main(
Fieldset('',
'username', 'password',
css_class='unsort no_title'
),
Fieldset(_('Personal info'),
Row('first_name', 'last_name'),
'email'
),
Fieldset(_('Permissions'),
'groups', 'user_permissions'
),
Fieldset(_('Important dates'),
'last_login', 'date_joined'
),
),
Side(
Fieldset(_('Status'),
'is_active', 'is_staff', 'is_superuser',
),
)
)
return super(UserAdmin, self).get_form_layout()
class BaseSetting(object):
enable_themes = True
use_bootswatch = True
class GlobalSettings(object):
site_title = "慕学后台管理系统"
site_footer = "慕学在线网"
menu_style = "accordion"
class EmailVerifiyRecordAdmin(object):
list_display = ('code', 'email', 'send_type', 'send_time')
search_fields = ['code', 'email', 'send_type']
list_filter = ('code', 'email', 'send_type', 'send_time')
model_icon = 'fa fa-address-book-o'
class BannerAdmin(object):
list_display = ['title', 'image', 'url', 'index', 'add_time']
search_fields = ['title', 'image', 'url', 'index']
list_filter = ['title', 'image', 'url', 'index', 'add_time']
xadmin.site.register(Banner, BannerAdmin)
# xadmin.site.register(UserProfile, UserProfileAdmin)
xadmin.site.register(EmailVerifiyRecord, EmailVerifiyRecordAdmin)
xadmin.site.register(views.BaseAdminView, BaseSetting)
xadmin.site.register(views.CommAdminView, GlobalSettings)
1回答
-
qq_木鱼_14
2018-01-10
图标相同了,换个其他的图标
062018-01-15
相似问题