5.3 Add the users table to the xadmin background

Add the adminx.py file to the users module, which is the default file name for the xadmin background management. The content is:

from .models import EmailVerifyRecord, Banner
import xadmin


class EmailVerifyRecordAdmin(object):
    list_display = ('name', 'email', 'send_type', 'add_time')
    search_fields = ('name', 'email', 'send_type')
    list_filter = ('name', 'email', 'send_type', 'add_time')


class BannerAdmin(object):
    list_display = ('name', 'image', 'url', 'order', 'add_time')
    search_fields = ('name', 'image', 'url', 'order')
    list_filter = ('name', 'image', 'url', 'order', 'add_time')


xadmin.site.register (EmailVerifyRecord, EmailVerifyRecordAdmin)
xadmin.site.register(Banner, BannerAdmin)

 

Because UserProfile is the default user table, the system and xadmin will automatically process the user table, so there is no need to add it, but only add mailbox verification and carousel. The email verification needs to be modified:

    class Meta:
        verbose_name = 'email verification code'
        verbose_name_plural = verbose_name

    def __str__(self):
        return '{0}({1})'.format(self.name, self.email)

  It is not the name that is returned, but the combination of name and email.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325220739&siteId=291194637