- dashboard: Note→Post, Item→Line across models, forms, views, API, urls & tests - new-post (9×3) & my-posts (3×3) applets migrate from dashboard→billboard context; billboard view passes form & recent_posts - drama: Recognition→Note, related_name notes; billboard URL /recognition/→/my-notes/, set-palette at /note/<slug>/set-palette - recognition.js→note.js (module Note, data.note key); recognition-page.js→note-page.js; .recog-*→.note-* - _recognition.scss→_note.scss; BillNotes page header; applet slug billboard-recognition→billboard-notes (My Notes) - NoteSpec.js replaces RecognitionSpec.js; test_recognition.py→test_applet_my_notes.py - 4 migrations applied: dashboard 0004, applets 0011+0012, drama 0005; 683 ITs green Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
931 B
Python
40 lines
931 B
Python
import uuid
|
|
|
|
from django.db import models
|
|
from django.urls import reverse
|
|
|
|
|
|
class Post(models.Model):
|
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
|
owner = models.ForeignKey(
|
|
"lyric.User",
|
|
related_name="posts",
|
|
blank=True,
|
|
null=True,
|
|
on_delete=models.CASCADE,
|
|
)
|
|
|
|
shared_with = models.ManyToManyField(
|
|
"lyric.User",
|
|
related_name="shared_posts",
|
|
blank=True,
|
|
)
|
|
|
|
@property
|
|
def name(self):
|
|
return self.lines.first().text
|
|
|
|
def get_absolute_url(self):
|
|
return reverse("view_post", args=[self.id])
|
|
|
|
class Line(models.Model):
|
|
text = models.TextField(default="")
|
|
post = models.ForeignKey(Post, default=None, on_delete=models.CASCADE, related_name="lines")
|
|
|
|
class Meta:
|
|
ordering = ("id",)
|
|
unique_together = ("post", "text")
|
|
|
|
def __str__(self):
|
|
return self.text
|