Browse Source

Bug Fix

pull/1110/head
Eduardo Calil 8 years ago
parent
commit
ba269ca4d4
  1. 20
      sapl/base/migrations/0003_auto_20170519_1106.py
  2. 2
      sapl/base/models.py
  3. 22
      sapl/legacy/migration.py
  4. 27
      sapl/norma/migrations/0004_auto_20170522_1115.py
  5. 2
      sapl/norma/models.py

20
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'),
),
]

2
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)

22
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:
@ -723,6 +739,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(
@ -753,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,
@ -766,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,
}

27
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),
),
]

2
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')

Loading…
Cancel
Save