You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
635 B
27 lines
635 B
from django.contrib import admin |
|
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin |
|
from django.contrib.auth.models import User |
|
from django import forms |
|
from .models import Account |
|
|
|
|
|
class AccountInlineForm(forms.ModelForm): |
|
hased_email_set = forms.EmailField(label='Set hashed email address') |
|
|
|
class Meta: |
|
model = Account |
|
fields = ['hashed_email'] |
|
|
|
|
|
class AccountInline(admin.StackedInline): |
|
model = Account |
|
can_delete = False |
|
form = AccountInlineForm |
|
|
|
|
|
class UserAdmin(BaseUserAdmin): |
|
inlines = (AccountInline,) |
|
|
|
|
|
admin.site.unregister(User) |
|
admin.site.register(User, UserAdmin)
|
|
|