Lets operators exclude a course from the aluno export file without deleting it. Existing courses already marked "Em extinção" are backfilled to exportar=False by the migration.
34 lines
806 B
Python
34 lines
806 B
Python
# Generated by Django 5.2.14 on 2026-07-06 18:46
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
def marcar_cursos_extintos_como_nao_exportar(apps, schema_editor):
|
|
Curso = apps.get_model("core", "Curso")
|
|
Curso.objects.filter(
|
|
situacao_funcionamento_curso__iregex=r"^em extin[cç][aã]o$"
|
|
).update(exportar=False)
|
|
|
|
|
|
def reverter(apps, schema_editor):
|
|
pass
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('core', '0013_pessoa_atualizado_manualmente_and_more'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name='curso',
|
|
name='exportar',
|
|
field=models.BooleanField(default=True),
|
|
),
|
|
migrations.RunPython(
|
|
marcar_cursos_extintos_como_nao_exportar,
|
|
reverter,
|
|
),
|
|
]
|