feat: add daily + global notes

This commit is contained in:
2026-07-17 14:43:05 +02:00
parent d2270a737b
commit 0cfe4c7108
7 changed files with 349 additions and 3 deletions
+38
View File
@@ -122,6 +122,44 @@ class ReminderSent(models.Model):
return f"{self.date}{self.scheduled_dose}"
class DailyNote(models.Model):
"""Free-form journal entry for one day: appetite, behaviour, how Osiris is doing."""
date = models.DateField(default=timezone.localdate, unique=True)
body = models.TextField(blank=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
ordering = ["-date"]
def __str__(self):
return f"{self.date}{self.body[:40]}"
class GlobalNote(models.Model):
"""The single shared note: standing instructions and things to do.
There is exactly one row, shared by everyone; the constraint pins its pk
so a second one cannot be created even by accident.
"""
body = models.TextField(blank=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
constraints = [
models.CheckConstraint(condition=models.Q(id=1), name="single_global_note")
]
def __str__(self):
return "Global note"
@classmethod
def load(cls) -> "GlobalNote":
note, _ = cls.objects.get_or_create(pk=1)
return note
class PulseReading(models.Model):
"""One heart-rate measurement per day, in beats per minute."""