27 lines
858 B
Python
27 lines
858 B
Python
from django.contrib import admin
|
|
from django.contrib.auth.admin import UserAdmin
|
|
|
|
from accounts.models import ApiToken, PushSubscription, User
|
|
|
|
|
|
@admin.register(User)
|
|
class OsirisUserAdmin(UserAdmin):
|
|
pass
|
|
|
|
|
|
@admin.register(PushSubscription)
|
|
class PushSubscriptionAdmin(admin.ModelAdmin):
|
|
"""Devices receiving reminders. Delete a row to stop pushing to that device."""
|
|
|
|
list_display = ["user", "user_agent", "created_at", "last_success_at"]
|
|
readonly_fields = ["endpoint", "p256dh", "auth", "created_at", "last_success_at"]
|
|
|
|
|
|
@admin.register(ApiToken)
|
|
class ApiTokenAdmin(admin.ModelAdmin):
|
|
"""Tokens are created by the Flutter app via /api/auth/login; this is for revoking."""
|
|
|
|
list_display = ["name", "user", "key", "created_at", "last_used_at"]
|
|
readonly_fields = ["key", "created_at", "last_used_at"]
|
|
list_filter = ["user"]
|