From 30928396668b0ac1bf5492e5d1e0836a73311a6e Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Fri, 19 May 2017 11:06:03 -0300 Subject: [PATCH 1/4] Adicionando nome da comissao em autor Signed-off-by: Luciano Almeida --- sapl/legacy/migration.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sapl/legacy/migration.py b/sapl/legacy/migration.py index baf105e74..c8e736694 100644 --- a/sapl/legacy/migration.py +++ b/sapl/legacy/migration.py @@ -723,6 +723,7 @@ def adjust_autor(new, old): new.nome = new.autor_related.nome_parlamentar elif old.cod_comissao: new.autor_related = Comissao.objects.get(pk=old.cod_comissao) + new.nome = new.autor_related.nome if old.col_username: if not get_user_model().objects.filter( From c9c5122e6f621216ff871d481b386725303a651d Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Fri, 19 May 2017 11:08:33 -0300 Subject: [PATCH 2/4] Mudando tamanho do campo nome do autor Signed-off-by: Luciano Almeida --- .../migrations/0003_auto_20170519_1106.py | 20 +++++++++++++++++++ sapl/base/models.py | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 sapl/base/migrations/0003_auto_20170519_1106.py diff --git a/sapl/base/migrations/0003_auto_20170519_1106.py b/sapl/base/migrations/0003_auto_20170519_1106.py new file mode 100644 index 000000000..f16a20172 --- /dev/null +++ b/sapl/base/migrations/0003_auto_20170519_1106.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.12 on 2017-05-19 11:06 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0002_auto_20170331_1900'), + ] + + operations = [ + migrations.AlterField( + model_name='autor', + name='nome', + field=models.CharField(blank=True, max_length=60, verbose_name='Nome do Autor'), + ), + ] diff --git a/sapl/base/models.py b/sapl/base/models.py index 9dd0f5ec3..3edef25e9 100644 --- a/sapl/base/models.py +++ b/sapl/base/models.py @@ -211,7 +211,7 @@ class Autor(models.Model): autor_related = GenericForeignKey('content_type', 'object_id') nome = models.CharField( - max_length=50, blank=True, verbose_name=_('Nome do Autor')) + max_length=60, blank=True, verbose_name=_('Nome do Autor')) cargo = models.CharField(max_length=50, blank=True) From 1dc343d246fab65236340f8591fbf78342596a35 Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Mon, 22 May 2017 11:16:34 -0300 Subject: [PATCH 3/4] Muda timestamp de norma pra null Signed-off-by: Luciano Almeida --- .../migrations/0004_auto_20170522_1115.py | 27 +++++++++++++++++++ sapl/norma/models.py | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 sapl/norma/migrations/0004_auto_20170522_1115.py diff --git a/sapl/norma/migrations/0004_auto_20170522_1115.py b/sapl/norma/migrations/0004_auto_20170522_1115.py new file mode 100644 index 000000000..26e390bdb --- /dev/null +++ b/sapl/norma/migrations/0004_auto_20170522_1115.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.12 on 2017-05-22 11:15 +from __future__ import unicode_literals + +from django.db import migrations, models +import sapl.norma.models +import sapl.utils + + +class Migration(migrations.Migration): + + dependencies = [ + ('norma', '0003_auto_20170510_1549'), + ] + + operations = [ + migrations.AlterField( + model_name='normajuridica', + name='texto_integral', + field=models.FileField(blank=True, null=True, upload_to=sapl.norma.models.norma_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Integral'), + ), + migrations.AlterField( + model_name='normajuridica', + name='timestamp', + field=models.DateTimeField(null=True), + ), + ] diff --git a/sapl/norma/models.py b/sapl/norma/models.py index db552c9a9..20166e7f5 100644 --- a/sapl/norma/models.py +++ b/sapl/norma/models.py @@ -116,7 +116,7 @@ class NormaJuridica(models.Model): AssuntoNorma, blank=True, verbose_name=_('Assuntos')) data_vigencia = models.DateField(blank=True, null=True) - timestamp = models.DateTimeField() + timestamp = models.DateTimeField(null=True) texto_articulado = GenericRelation( TextoArticulado, related_query_name='texto_articulado') From 0b0bd3a166cfee56392e7077fdd90ad54fcb0d62 Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Mon, 22 May 2017 11:18:48 -0300 Subject: [PATCH 4/4] =?UTF-8?q?Adiciona=20n=C3=BAmero=20da=20ordem=20do=20?= =?UTF-8?q?dia=20caso=20seja=20nulo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Luciano Almeida --- sapl/legacy/migration.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/sapl/legacy/migration.py b/sapl/legacy/migration.py index c8e736694..7efa97f73 100644 --- a/sapl/legacy/migration.py +++ b/sapl/legacy/migration.py @@ -580,11 +580,27 @@ def migrate(obj=appconfs, interativo=True): # MIGRATION_ADJUSTMENTS ##################################################### -def adjust_ordemdia(new, old): +def adjust_ordemdia_antes_salvar(new, old): # Prestar atenção if not old.tip_votacao: new.tipo_votacao = 1 + if old.num_ordem is None: + new.numero_ordem = 999999999 + + +def adjust_ordemdia_depois_salvar(new, old): + if old.num_ordem is None and new.numero_ordem == 999999999: + with reversion.create_revision(): + problema = 'OrdemDia de PK %s tinha seu valor de numero ordem'\ + ' nulo.' % old.pk + descricao = 'O valor %s foi colocado no lugar.' % new.numero_ordem + warn(problema + ' => ' + descricao) + save_relation(obj=new, problema=problema, + descricao=descricao, eh_stub=False) + reversion.set_comment('OrdemDia sem número da ordem.') + pass + def adjust_parlamentar(new, old): if old.ind_unid_deliberativa: @@ -754,7 +770,7 @@ AJUSTE_ANTES_SALVAR = { Comissao: adjust_comissao, NormaJuridica: adjust_normajuridica_antes_salvar, NormaRelacionada: adjust_normarelacionada, - OrdemDia: adjust_ordemdia, + OrdemDia: adjust_ordemdia_antes_salvar, Parlamentar: adjust_parlamentar, Participacao: adjust_participacao, Protocolo: adjust_protocolo, @@ -767,6 +783,7 @@ AJUSTE_ANTES_SALVAR = { AJUSTE_DEPOIS_SALVAR = { NormaJuridica: adjust_normajuridica_depois_salvar, + OrdemDia: adjust_ordemdia_depois_salvar, Protocolo: adjust_protocolo_depois_salvar, RegistroVotacao: adjust_registrovotacao_depois_salvar, }