30 lines
983 B
Python
30 lines
983 B
Python
from django.db import migrations
|
|
|
|
|
|
def fix_billboard_applets(apps, schema_editor):
|
|
Applet = apps.get_model("applets", "Applet")
|
|
# billboard-scroll belongs only to the billscroll page template, not the grid
|
|
Applet.objects.filter(slug="billboard-scroll").delete()
|
|
# Rename "My Contacts" → "Contacts"
|
|
Applet.objects.filter(slug="billboard-my-contacts").update(name="Contacts")
|
|
|
|
|
|
def reverse_fix_billboard_applets(apps, schema_editor):
|
|
Applet = apps.get_model("applets", "Applet")
|
|
Applet.objects.get_or_create(
|
|
slug="billboard-scroll",
|
|
defaults={"name": "Billscroll", "grid_cols": 12, "grid_rows": 6, "context": "billboard"},
|
|
)
|
|
Applet.objects.filter(slug="billboard-my-contacts").update(name="My Contacts")
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
("applets", "0006_billboard_applets"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(fix_billboard_applets, reverse_fix_billboard_applets),
|
|
]
|