forked from beba/foerderbarometer
32 lines
890 B
Python
32 lines
890 B
Python
# Generated by Django 5.2.5 on 2026-01-06 10:31
|
|
|
|
from django.db import migrations
|
|
|
|
from input.utils.migrations import get_queryset
|
|
from input.utils.quarter import get_quarter_label
|
|
|
|
|
|
def fix_project_end_quartal(apps, schema_editor):
|
|
projects = get_queryset(apps, schema_editor, 'input', 'Project').exclude(end=None).only('end', 'end_quartal')
|
|
|
|
for project in projects:
|
|
end_quartal = get_quarter_label(project.end.month)
|
|
|
|
if project.end_quartal != end_quartal:
|
|
project.end_quartal = end_quartal
|
|
project.save(update_fields=['end_quartal'], force_update=True)
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('input', '0107_alter_category_other_fields'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(
|
|
code=fix_project_end_quartal,
|
|
reverse_code=migrations.RunPython.noop,
|
|
),
|
|
]
|