diff --git a/core/migrations/0014_curso_exportar.py b/core/migrations/0014_curso_exportar.py new file mode 100644 index 0000000..a69300c --- /dev/null +++ b/core/migrations/0014_curso_exportar.py @@ -0,0 +1,33 @@ +# 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, + ), + ] diff --git a/core/models.py b/core/models.py index 1eb8531..2ba7856 100644 --- a/core/models.py +++ b/core/models.py @@ -68,6 +68,7 @@ class Curso(models.Model): situacao_funcionamento_curso = models.CharField(max_length=100, blank=True) licenciatura = models.BooleanField(default=False) ead = models.BooleanField(default=False) + exportar = models.BooleanField(default=True) carga_horaria_total = models.PositiveIntegerField() polo = models.ForeignKey( "Polo", diff --git a/core/views.py b/core/views.py index 99688ce..e238ba1 100644 --- a/core/views.py +++ b/core/views.py @@ -113,6 +113,7 @@ CRUD_CONFIGS = { "ead", "polo", "carga_horaria_total", + "exportar", ), search_fields=( ("codigo_mec", "int"),