from django.contrib import admin
from django.contrib.auth.models import User
from .models import UserProfile, EmailVerifyRecord
from django.contrib.auth.admin import UserAdmin


# 取消关联注册
admin.site.unregister(User)


class UserProfileInline(admin.StackedInline):
    # 关联的模型
    model = UserProfile


# 关联UserProfile
class UserProfileAdmin(UserAdmin):
    inlines = [UserProfileInline]


# 注册User模型
admin.site.register(User, UserProfileAdmin)


@admin.register(EmailVerifyRecord)
class Admin(admin.ModelAdmin):
    list_display = ('code', )
