lemoncurry/users/admin.py

32 lines
749 B
Python

from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from .models import PgpKey, Profile, Site, User
class SiteAdmin(admin.ModelAdmin):
list_display = ("name", "icon", "domain", "url_template")
class PgpKeyInline(admin.TabularInline):
model = PgpKey
extra = 1
class ProfileInline(admin.TabularInline):
model = Profile
extra = 1
class UserAdmin(BaseUserAdmin):
fieldsets = BaseUserAdmin.fieldsets + (
("Profile", {"fields": ("avatar", "xmpp", "note")}),
("Nostr", {"fields": ("nostr_key", "nostr_relays")}),
)
inlines = (
PgpKeyInline,
ProfileInline,
)
admin.site.register(Site, SiteAdmin)
admin.site.register(User, UserAdmin)