mirror of
https://github.com/ae-utbm/sith.git
synced 2026-11-20 16:09:54 +00:00
Proposition V1
This commit is contained in:
1 parent
bfa5fa45b8
commit
fc961f6511
36 files changed
+1984
No files matched your search
@@ -0,0 +1,47 @@
|
||||
# Generated by Django 5.2.18 on 2026-11-09 06:57
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def add_stock_groups(apps, schema_editor):
|
||||
Club = apps.get_model("club", "Club")
|
||||
Group = apps.get_model("core", "Group")
|
||||
for club in Club.objects.all():
|
||||
new_group = Group.objects.create(
|
||||
name=f"{club.name} - Stock",
|
||||
is_manually_manageable=False,
|
||||
)
|
||||
club.stock_group = new_group
|
||||
club.save()
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('club', '0019_remove_mailingsubscription_mailing_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="club",
|
||||
name="stock_group",
|
||||
field=models.OneToOneField(
|
||||
null=True,
|
||||
editable=False,
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name="club_stock",
|
||||
to="core.group",
|
||||
),
|
||||
),
|
||||
migrations.RunPython(add_stock_groups),
|
||||
migrations.AlterField(
|
||||
model_name="club",
|
||||
name="stock_group",
|
||||
field=models.OneToOneField(
|
||||
editable=False,
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name="club_stock",
|
||||
to="core.group",
|
||||
),
|
||||
),
|
||||
]
|
||||
Reference in new issue
Block a user