From 59b0d7ee2308db45a386d7bac75c966160fe8038 Mon Sep 17 00:00:00 2001 From: Leandro Roberto Date: Tue, 23 Apr 2019 12:09:57 -0300 Subject: [PATCH] add migration para corrigir caput nao autoinserido --- .../migrations/0012_bug_auto_inserido.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 sapl/compilacao/migrations/0012_bug_auto_inserido.py diff --git a/sapl/compilacao/migrations/0012_bug_auto_inserido.py b/sapl/compilacao/migrations/0012_bug_auto_inserido.py new file mode 100644 index 000000000..ac07c0a44 --- /dev/null +++ b/sapl/compilacao/migrations/0012_bug_auto_inserido.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.13 on 2018-03-19 13:41 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +def adjust_bug_auto_inserido(apps, schema_editor): + Dispositivo = apps.get_model('compilacao', 'Dispositivo') + + Dispositivo.objects.filter( + tipo_dispositivo__class_css__startswith='caput', + dispositivo_pai__tipo_dispositivo__class_css__startswith='artigo', + auto_inserido=False + ).update(auto_inserido=True) + + +class Migration(migrations.Migration): + + dependencies = [ + ('compilacao', '0011_tipotextoarticulado_rodape_global'), + ] + + operations = [ + migrations.RunPython(adjust_bug_auto_inserido), + ]