lemoncurry/users/admin.py

33 lines
749 B
Python
Raw Permalink Normal View History

2017-10-22 18:04:59 -04:00
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from .models import PgpKey, Profile, Site, User
2017-10-22 21:33:24 -04:00
class SiteAdmin(admin.ModelAdmin):
2023-08-10 02:52:37 -04:00
list_display = ("name", "icon", "domain", "url_template")
class PgpKeyInline(admin.TabularInline):
model = PgpKey
2017-10-22 21:33:24 -04:00
extra = 1
2017-10-22 18:04:59 -04:00
2017-10-22 21:59:10 -04:00
class ProfileInline(admin.TabularInline):
model = Profile
extra = 1
class UserAdmin(BaseUserAdmin):
fieldsets = BaseUserAdmin.fieldsets + (
2023-08-10 02:52:37 -04:00
("Profile", {"fields": ("avatar", "xmpp", "note")}),
2023-08-10 04:05:46 -04:00
("Nostr", {"fields": ("nostr_key", "nostr_relays")}),
)
2017-10-22 21:33:24 -04:00
inlines = (
PgpKeyInline,
2017-10-22 21:59:10 -04:00
ProfileInline,
2017-10-22 21:33:24 -04:00
)
admin.site.register(Site, SiteAdmin)
2017-10-22 18:04:59 -04:00
admin.site.register(User, UserAdmin)