feat: add daily + global notes
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from tracker.models import (
|
||||
DailyNote,
|
||||
DoseLog,
|
||||
GlobalNote,
|
||||
Medication,
|
||||
PulseReading,
|
||||
ReminderSent,
|
||||
@@ -66,3 +68,29 @@ class DoseLogAdmin(admin.ModelAdmin):
|
||||
class PulseReadingAdmin(admin.ModelAdmin):
|
||||
list_display = ["date", "bpm", "notes"]
|
||||
date_hierarchy = "date"
|
||||
|
||||
|
||||
@admin.register(DailyNote)
|
||||
class DailyNoteAdmin(admin.ModelAdmin):
|
||||
"""The journal. Day-to-day writing happens on the Today page."""
|
||||
|
||||
list_display = ["date", "preview", "updated_at"]
|
||||
date_hierarchy = "date"
|
||||
search_fields = ["body"]
|
||||
|
||||
@admin.display(description="Note")
|
||||
def preview(self, obj: DailyNote) -> str:
|
||||
return obj.body[:80]
|
||||
|
||||
|
||||
@admin.register(GlobalNote)
|
||||
class GlobalNoteAdmin(admin.ModelAdmin):
|
||||
"""The one shared note. It can be edited here, but never added or deleted."""
|
||||
|
||||
list_display = ["__str__", "updated_at"]
|
||||
|
||||
def has_add_permission(self, request):
|
||||
return False
|
||||
|
||||
def has_delete_permission(self, request, obj=None):
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user