v0.2.1: top-bar avatar, You/Admin settings groups, admin models

- Replace the gear/username button with a round initials avatar (per-user
  deterministic color via a new daybook_extras template filter); dropdown
  now shows the username and keeps Settings/About/theme/logout. Sets up an
  optional profile photo later.
- Regroup the settings nav into "You" (Account, API Keys, Storage, Demo
  Data) and a superuser-only "Admin" (Users), About separate — the split
  now reflects who each setting affects, not a flat list.
- Register ApiKey (key read-only) and TagColor in Django admin so /admin/
  is complete as the operator break-glass tool, distinct from the themed
  Settings product surface.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
peter 2026-09-04 11:33:23 +01:00
parent 19c1798f90
commit b382eb857b
8 changed files with 134 additions and 12 deletions

View file

@ -1,6 +1,6 @@
from django.contrib import admin
from .models import Artifact, Asset, UserProfile
from .models import ApiKey, Artifact, Asset, TagColor, UserProfile
@admin.register(Artifact)
@ -21,3 +21,18 @@ class AssetAdmin(admin.ModelAdmin):
list_display = ("id", "owner", "artifact", "content_type", "size_bytes", "created_at")
list_filter = ("owner", "content_type")
search_fields = ("id",)
@admin.register(ApiKey)
class ApiKeyAdmin(admin.ModelAdmin):
list_display = ("name", "user", "key", "created_at", "last_used_at")
list_filter = ("user",)
search_fields = ("name", "key", "user__username")
# The key value and timestamps are system-managed; show but don't hand-edit.
readonly_fields = ("key", "created_at", "last_used_at")
@admin.register(TagColor)
class TagColorAdmin(admin.ModelAdmin):
list_display = ("name", "color")
search_fields = ("name",)