new applets app for cross-board usage of Applet() & UserApplet() models; dashboard migrations reset and apps reseeded w. new default specs; core.settings & many tests thru-out suite updated accordingly
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
# Generated by Django 6.0 on 2026-03-04 20:34
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('dashboard', '0001_initial'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Applet',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('slug', models.SlugField(unique=True)),
|
||||
('name', models.CharField(max_length=100)),
|
||||
('default_visible', models.BooleanField(default=True)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='UserApplet',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('visible', models.BooleanField(default=True)),
|
||||
('applet', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dashboard.applet')),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_applets', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'unique_together': {('user', 'applet')},
|
||||
},
|
||||
),
|
||||
]
|
||||
@@ -1,17 +0,0 @@
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def seed_applets(apps, schema_editor):
|
||||
Applet = apps.get_model("dashboard", "Applet")
|
||||
Applet.objects.get_or_create(slug="username", defaults={"name": "Username"})
|
||||
Applet.objects.get_or_create(slug="theme-switcher", defaults={"name": "Theme Switcher"})
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("dashboard", "0002_applet_userapplet"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(seed_applets, migrations.RunPython.noop),
|
||||
]
|
||||
@@ -1,23 +0,0 @@
|
||||
# Generated by Django 6.0 on 2026-03-06 22:29
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('dashboard', '0003_seed_applets'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='applet',
|
||||
name='grid_cols',
|
||||
field=models.PositiveSmallIntegerField(default=12),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='applet',
|
||||
name='grid_rows',
|
||||
field=models.PositiveSmallIntegerField(default=3),
|
||||
),
|
||||
]
|
||||
@@ -1,17 +0,0 @@
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def set_grid_defaults(apps, schema_editor):
|
||||
Applet = apps.get_model("dashboard", "Applet")
|
||||
Applet.objects.filter(slug__in=["username", "theme-switcher"]).update(grid_cols=6, grid_rows=3)
|
||||
Applet.objects.get_or_create(slug="new-list", defaults={"name": "New List", "grid_cols": 9, "grid_rows": 3})
|
||||
Applet.objects.get_or_create(slug="my-lists", defaults={"name": "My Lists", "grid_cols": 3, "grid_rows": 3})
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("dashboard", "0004_applet_grid_cols_applet_grid_rows"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(set_grid_defaults, migrations.RunPython.noop),
|
||||
]
|
||||
@@ -1,18 +0,0 @@
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def rename_theme_switcher(apps, schema_editor):
|
||||
Applet = apps.get_model("dashboard", "Applet")
|
||||
Applet.objects.filter(slug="theme-switcher").update(
|
||||
slug="palette", name="Palette", grid_cols=6, grid_rows=3
|
||||
)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("dashboard", "0005_set_applet_grid_defaults"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(rename_theme_switcher, migrations.RunPython.noop),
|
||||
]
|
||||
@@ -1,18 +0,0 @@
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def seed_wallet_applet(apps, schema_editor):
|
||||
Applet = apps.get_model("dashboard", "Applet")
|
||||
Applet.objects.get_or_create(
|
||||
slug="wallet",
|
||||
defaults={"name": "Wallet", "grid_cols": 12, "grid_rows": 3},
|
||||
)
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("dashboard", "0006_rename_theme_switcher"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(seed_wallet_applet, migrations.RunPython.noop),
|
||||
]
|
||||
Reference in New Issue
Block a user