2017-10-22 18:04:59 -04:00
|
|
|
from django.contrib import admin
|
2017-10-22 20:53:51 -04:00
|
|
|
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
2023-08-10 02:50:35 -04:00
|
|
|
from .models import PgpKey, Profile, Site, User
|
2017-10-22 21:33:24 -04:00
|
|
|
|
|
|
|
|
2017-10-29 07:44:11 -04:00
|
|
|
class SiteAdmin(admin.ModelAdmin):
|
2023-08-10 02:52:37 -04:00
|
|
|
list_display = ("name", "icon", "domain", "url_template")
|
2017-10-29 07:44:11 -04:00
|
|
|
|
|
|
|
|
2023-08-10 02:50:35 -04:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2017-10-22 20:53:51 -04:00
|
|
|
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 20:53:51 -04:00
|
|
|
)
|
2017-10-22 21:33:24 -04:00
|
|
|
inlines = (
|
2023-08-10 02:50:35 -04:00
|
|
|
PgpKeyInline,
|
2017-10-22 21:59:10 -04:00
|
|
|
ProfileInline,
|
2017-10-22 21:33:24 -04:00
|
|
|
)
|
2017-10-22 20:53:51 -04:00
|
|
|
|
|
|
|
|
2017-10-29 07:44:11 -04:00
|
|
|
admin.site.register(Site, SiteAdmin)
|
2017-10-22 18:04:59 -04:00
|
|
|
admin.site.register(User, UserAdmin)
|