Initial public commit
Daybook: a self-hosted, multi-user Django + DRF app where agents, scripts, or people publish artifacts and each logged-in user browses their own time-ordered, label-filterable feed. This squashes prior local development history (kept privately on a separate branch) into a single clean starting point for the public repository. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
commit
940a703cd7
62 changed files with 5755 additions and 0 deletions
27
artifacts/migrations/0006_backfill_owner.py
Normal file
27
artifacts/migrations/0006_backfill_owner.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
from django.db import migrations
|
||||
|
||||
|
||||
def backfill_owner(apps, schema_editor):
|
||||
User = apps.get_model("auth", "User")
|
||||
Artifact = apps.get_model("artifacts", "Artifact")
|
||||
|
||||
first_superuser = User.objects.filter(is_superuser=True).order_by("date_joined").first()
|
||||
if first_superuser is None:
|
||||
return
|
||||
|
||||
Artifact.objects.filter(owner__isnull=True).update(owner=first_superuser)
|
||||
|
||||
|
||||
def noop_reverse(apps, schema_editor):
|
||||
pass
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("artifacts", "0005_add_owner_nullable"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(backfill_owner, noop_reverse),
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue