xadmin中注册app 的class

2017-03-27  本文已影响97人  贾梦阳

1.引入头文件

from .models import EmailVerifyRecord

2.class

classEmailVerifyRecordAdmin(object):

list_display = ['code','email','send_type','send_time']     展示的列

search_fields = ['code','email','send_type']    搜索列(时间一般不进行搜索,会出错)

list_filter = ['code','email','send_type','send_time']   过滤器

3.注册

xadmin.site.register(EmailVerifyRecord, EmailVerifyRecordAdmin)

上一篇下一篇

猜你喜欢

热点阅读