billboard applets: drop billboard- prefix from partials & ids; Most Recent → Most Recent Scroll; room_scroll → scroll — TDD
- Slug renames (mig 0004): billboard-my-scrolls → my-scrolls; billboard-my-contacts → my-contacts; billboard-most-recent → most-recent-scroll (name → "Most Recent Scroll"); billboard-notes → notes - Partial filenames lose the `billboard-` token to mirror dashboard/gameboard convention; element ids follow (id_applet_my_scrolls, id_applet_my_contacts, id_applet_most_recent_scroll, id_applet_notes, id_applet_scroll); .applet-billboard-scroll → .applet-scroll - View fn billboard.views.room_scroll → scroll; template apps/billboard/room_scroll.html → scroll.html (URL name `billboard:scroll` already correct) - ITs + FTs updated to new identifiers; SCSS selectors retitled Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
"""Drop the legacy `billboard-` slug prefix from billboard applets and
|
||||
rename Most Recent → Most Recent Scroll.
|
||||
|
||||
The `billboard-` prefix snuck into seed migration 0003 against intent — no
|
||||
other context (dashboard, gameboard, wallet, game-kit) prefixes its applet
|
||||
slugs with the context name, and slugs need to stay portable so users can
|
||||
later rearrange which page hosts which applet.
|
||||
"""
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
RENAMES = [
|
||||
# (old_slug, new_slug, new_name_or_None)
|
||||
('billboard-my-scrolls', 'my-scrolls', None),
|
||||
('billboard-my-contacts', 'my-contacts', None),
|
||||
('billboard-most-recent', 'most-recent-scroll', 'Most Recent Scroll'),
|
||||
('billboard-notes', 'notes', None),
|
||||
]
|
||||
|
||||
|
||||
def _apply(apps, mapping):
|
||||
Applet = apps.get_model('applets', 'Applet')
|
||||
for old_slug, new_slug, new_name in mapping:
|
||||
try:
|
||||
applet = Applet.objects.get(slug=old_slug)
|
||||
except Applet.DoesNotExist:
|
||||
continue
|
||||
applet.slug = new_slug
|
||||
fields = ['slug']
|
||||
if new_name is not None:
|
||||
applet.name = new_name
|
||||
fields.append('name')
|
||||
applet.save(update_fields=fields)
|
||||
|
||||
|
||||
def forward(apps, schema_editor):
|
||||
_apply(apps, RENAMES)
|
||||
|
||||
|
||||
def backward(apps, schema_editor):
|
||||
inverse = [
|
||||
(new, old, 'Most Recent' if old == 'billboard-most-recent' else None)
|
||||
for (old, new, _) in RENAMES
|
||||
]
|
||||
_apply(apps, inverse)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('applets', '0003_seed_applets'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(forward, backward),
|
||||
]
|
||||
Reference in New Issue
Block a user