From 16ddaca90a56ab774a10f6fb3097631a1b40809f Mon Sep 17 00:00:00 2001 From: LeandroRoberto Date: Sat, 26 Dec 2015 13:44:24 -0200 Subject: [PATCH] Ajustes iniciais em TextoArticulado --- .../migrations/0033_auto_20151222_1608.py | 119 ------------------ .../migrations/0033_auto_20151226_1320.py | 115 +++++++++++++++++ .../migrations/0034_auto_20151222_1609.py | 22 ---- .../migrations/0034_auto_20151226_1321.py | 18 +++ .../migrations/0035_auto_20151223_1709.py | 32 ----- .../migrations/0036_auto_20151224_1341.py | 23 ---- .../migrations/0037_auto_20151224_1348.py | 19 --- .../migrations/0038_auto_20151224_1429.py | 24 ---- .../migrations/0039_auto_20151224_1846.py | 19 --- compilacao/urls.py | 2 +- materia/urls.py | 1 - norma/migrations/0009_auto_20151224_1637.py | 49 -------- norma/models.py | 10 +- norma/urls.py | 2 +- sapl/settings.py | 2 +- templates/compilacao/text_list_bloco.html | 5 +- 16 files changed, 145 insertions(+), 317 deletions(-) delete mode 100644 compilacao/migrations/0033_auto_20151222_1608.py create mode 100644 compilacao/migrations/0033_auto_20151226_1320.py delete mode 100644 compilacao/migrations/0034_auto_20151222_1609.py create mode 100644 compilacao/migrations/0034_auto_20151226_1321.py delete mode 100644 compilacao/migrations/0035_auto_20151223_1709.py delete mode 100644 compilacao/migrations/0036_auto_20151224_1341.py delete mode 100644 compilacao/migrations/0037_auto_20151224_1348.py delete mode 100644 compilacao/migrations/0038_auto_20151224_1429.py delete mode 100644 compilacao/migrations/0039_auto_20151224_1846.py delete mode 100644 norma/migrations/0009_auto_20151224_1637.py diff --git a/compilacao/migrations/0033_auto_20151222_1608.py b/compilacao/migrations/0033_auto_20151222_1608.py deleted file mode 100644 index ae5f7a647..000000000 --- a/compilacao/migrations/0033_auto_20151222_1608.py +++ /dev/null @@ -1,119 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0032_auto_20151213_1538'), - ] - - operations = [ - migrations.CreateModel( - name='PerfilEstruturalTextoArticulado', - fields=[ - ('id', models.AutoField( - auto_created=True, serialize=False, primary_key=True, - verbose_name='ID')), - ('sigla', models.CharField( - unique=True, max_length=10, verbose_name='Sigla')), - ('nome', models.CharField(max_length=50, verbose_name='Nome')), - ('padrao', models.BooleanField( - choices=[(True, 'Sim'), (False, 'Não')], default=False, - verbose_name='Padrão')), - ], - options={ - 'verbose_name_plural': 'Perfis Estruturais de' - ' Textos Articulados', - 'verbose_name': 'Perfil Estrutural de Texto Articulado', - 'ordering': ['-padrao', 'sigla'], - }, - ), - migrations.CreateModel( - name='TextoArticulado', - fields=[ - ('id', models.AutoField( - auto_created=True, - serialize=False, primary_key=True, verbose_name='ID')), - ('created', models.DateTimeField( - auto_now_add=True, verbose_name='created')), - ('modified', models.DateTimeField( - auto_now=True, verbose_name='modified')), - ('data', models.DateField( - blank=True, null=True, verbose_name='Data')), - ('ementa', models.TextField(verbose_name='Ementa')), - ('observacao', models.TextField( - blank=True, null=True, verbose_name='Observação')), - ('numero', models.PositiveIntegerField(verbose_name='Número')), - ('ano', models.PositiveSmallIntegerField(verbose_name='Ano')), - ], - options={ - 'verbose_name_plural': 'Textos Articulados', - 'verbose_name': 'Texto Articulado', - }, - ), - migrations.AlterModelOptions( - name='dispositivo', - options={'verbose_name_plural': 'Dispositivos', - 'verbose_name': 'Dispositivo'}, - ), - migrations.RemoveField( - model_name='publicacao', - name='norma', - ), - migrations.AlterField( - model_name='dispositivo', - name='visibilidade', - field=models.BooleanField(choices=[( - True, 'Sim'), (False, 'Não')], default=False, - verbose_name='Visibilidade no Texto Articulado Publicado'), - ), - migrations.AlterField( - model_name='tipodispositivorelationship', - name='perfil', - field=models.ForeignKey( - to='compilacao.PerfilEstruturalTextoArticulado'), - ), - migrations.AlterUniqueTogether( - name='dispositivo', - unique_together=set([]), - ), - migrations.DeleteModel( - name='PerfilEstruturalTextosNormativos', - ), - migrations.RemoveField( - model_name='dispositivo', - name='norma', - ), - migrations.RemoveField( - model_name='dispositivo', - name='norma_publicada', - ), - migrations.AddField( - model_name='dispositivo', - name='ta', - field=models.ForeignKey( - related_name='dispositivos_set', - verbose_name='Texto Articulado', - to='compilacao.TextoArticulado', default=1), - preserve_default=False, - ), - migrations.AddField( - model_name='dispositivo', - name='ta_publicado', - field=models.ForeignKey( - related_name='dispositivos_alterados_pelo_ta_set', blank=True, - verbose_name='Texto Articulado Publicado', - default=None, to='compilacao.TextoArticulado', null=True), - ), - migrations.AddField( - model_name='publicacao', - name='ta', - field=models.ForeignKey( - verbose_name='Texto Articulado', - to='compilacao.TextoArticulado', default=1), - preserve_default=False, - ), - ] diff --git a/compilacao/migrations/0033_auto_20151226_1320.py b/compilacao/migrations/0033_auto_20151226_1320.py new file mode 100644 index 000000000..db1b3b145 --- /dev/null +++ b/compilacao/migrations/0033_auto_20151226_1320.py @@ -0,0 +1,115 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('compilacao', '0032_auto_20151213_1538'), + ] + + operations = [ + migrations.CreateModel( + name='PerfilEstruturalTextoArticulado', + fields=[ + ('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')), + ('sigla', models.CharField(unique=True, max_length=10, verbose_name='Sigla')), + ('nome', models.CharField(max_length=50, verbose_name='Nome')), + ('padrao', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Padrão')), + ], + options={ + 'verbose_name_plural': 'Perfis Estruturais de Textos Articulados', + 'verbose_name': 'Perfil Estrutural de Texto Articulado', + 'ordering': ['-padrao', 'sigla'], + }, + ), + migrations.CreateModel( + name='TextoArticulado', + fields=[ + ('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')), + ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')), + ('modified', models.DateTimeField(auto_now=True, verbose_name='modified')), + ('data', models.DateField(null=True, verbose_name='Data', blank=True)), + ('ementa', models.TextField(verbose_name='Ementa')), + ('observacao', models.TextField(null=True, verbose_name='Observação', blank=True)), + ('numero', models.PositiveIntegerField(verbose_name='Número')), + ('ano', models.PositiveSmallIntegerField(verbose_name='Ano')), + ('participacao_social', models.NullBooleanField(choices=[(None, 'Padrão definido no Tipo'), (True, 'Sim'), (False, 'Não')], default=None, verbose_name='Participação Social')), + ], + options={ + 'verbose_name_plural': 'Textos Articulados', + 'verbose_name': 'Texto Articulado', + 'ordering': ['-data', '-numero'], + }, + ), + migrations.CreateModel( + name='TipoTextoArticulado', + fields=[ + ('id', models.AutoField(serialize=False, auto_created=True, primary_key=True, verbose_name='ID')), + ('sigla', models.CharField(max_length=3, verbose_name='Sigla')), + ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), + ('participacao_social', models.NullBooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Participação Social')), + ], + options={ + 'verbose_name_plural': 'Tipos de Texto Articulados', + 'verbose_name': 'Tipo de Texto Articulado', + }, + ), + migrations.AlterModelOptions( + name='dispositivo', + options={'verbose_name_plural': 'Dispositivos', 'verbose_name': 'Dispositivo', 'ordering': ['ta', 'ordem']}, + ), + migrations.RemoveField( + model_name='publicacao', + name='norma', + ), + migrations.AlterField( + model_name='dispositivo', + name='visibilidade', + field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Visibilidade no Texto Articulado Publicado'), + ), + migrations.AlterField( + model_name='tipodispositivorelationship', + name='perfil', + field=models.ForeignKey(to='compilacao.PerfilEstruturalTextoArticulado'), + ), + migrations.AlterUniqueTogether( + name='dispositivo', + unique_together=set([]), + ), + migrations.DeleteModel( + name='PerfilEstruturalTextosNormativos', + ), + migrations.AddField( + model_name='textoarticulado', + name='tipo_ta', + field=models.ForeignKey(to='compilacao.TipoTextoArticulado', default=None, blank=True, null=True, verbose_name='Tipo de Texto Articulado'), + ), + migrations.RemoveField( + model_name='dispositivo', + name='norma', + ), + migrations.RemoveField( + model_name='dispositivo', + name='norma_publicada', + ), + migrations.AddField( + model_name='dispositivo', + name='ta', + field=models.ForeignKey(default=1, to='compilacao.TextoArticulado', related_name='dispositivos_set', verbose_name='Texto Articulado'), + preserve_default=False, + ), + migrations.AddField( + model_name='dispositivo', + name='ta_publicado', + field=models.ForeignKey(to='compilacao.TextoArticulado', default=None, blank=True, null=True, related_name='dispositivos_alterados_pelo_ta_set', verbose_name='Texto Articulado Publicado'), + ), + migrations.AddField( + model_name='publicacao', + name='ta', + field=models.ForeignKey(default=1, to='compilacao.TextoArticulado', verbose_name='Texto Articulado'), + preserve_default=False, + ), + ] diff --git a/compilacao/migrations/0034_auto_20151222_1609.py b/compilacao/migrations/0034_auto_20151222_1609.py deleted file mode 100644 index f77cd2634..000000000 --- a/compilacao/migrations/0034_auto_20151222_1609.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0033_auto_20151222_1608'), - ] - - operations = [ - migrations.AlterModelOptions( - name='dispositivo', - options={'ordering': ['ta', 'ordem'], 'verbose_name_plural': 'Dispositivos', 'verbose_name': 'Dispositivo'}, - ), - migrations.AlterUniqueTogether( - name='dispositivo', - unique_together=set([('ta', 'dispositivo0', 'dispositivo1', 'dispositivo2', 'dispositivo3', 'dispositivo4', 'dispositivo5', 'tipo_dispositivo', 'dispositivo_pai', 'ta_publicado', 'publicacao'), ('ta', 'ordem')]), - ), - ] diff --git a/compilacao/migrations/0034_auto_20151226_1321.py b/compilacao/migrations/0034_auto_20151226_1321.py new file mode 100644 index 000000000..6f4c8f6d1 --- /dev/null +++ b/compilacao/migrations/0034_auto_20151226_1321.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('compilacao', '0033_auto_20151226_1320'), + ] + + operations = [ + migrations.AlterUniqueTogether( + name='dispositivo', + unique_together=set([('ta', 'ordem'), ('ta', 'dispositivo0', 'dispositivo1', 'dispositivo2', 'dispositivo3', 'dispositivo4', 'dispositivo5', 'tipo_dispositivo', 'dispositivo_pai', 'ta_publicado', 'publicacao')]), + ), + ] diff --git a/compilacao/migrations/0035_auto_20151223_1709.py b/compilacao/migrations/0035_auto_20151223_1709.py deleted file mode 100644 index 071cf3da5..000000000 --- a/compilacao/migrations/0035_auto_20151223_1709.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0034_auto_20151222_1609'), - ] - - operations = [ - migrations.CreateModel( - name='TipoTextoArticulado', - fields=[ - ('id', models.AutoField(auto_created=True, serialize=False, primary_key=True, verbose_name='ID')), - ('sigla', models.CharField(max_length=3, verbose_name='Sigla')), - ('descricao', models.CharField(max_length=50, verbose_name='Descrição')), - ], - options={ - 'verbose_name_plural': 'Tipos de Texto Articulados', - 'verbose_name': 'Tipo de Texto Articulado', - }, - ), - migrations.AddField( - model_name='textoarticulado', - name='tipo_ta', - field=models.ForeignKey(to='compilacao.TipoTextoArticulado', default=1, verbose_name='Tipo de Texto Articulado'), - preserve_default=False, - ), - ] diff --git a/compilacao/migrations/0036_auto_20151224_1341.py b/compilacao/migrations/0036_auto_20151224_1341.py deleted file mode 100644 index a90b7861c..000000000 --- a/compilacao/migrations/0036_auto_20151224_1341.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0035_auto_20151223_1709'), - ] - - operations = [ - migrations.AlterModelOptions( - name='textoarticulado', - options={'verbose_name': 'Texto Articulado', 'verbose_name_plural': 'Textos Articulados', 'ordering': ['-data', '-numero']}, - ), - migrations.AddField( - model_name='textoarticulado', - name='participacao_social', - field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Participação Social', default=False), - ), - ] diff --git a/compilacao/migrations/0037_auto_20151224_1348.py b/compilacao/migrations/0037_auto_20151224_1348.py deleted file mode 100644 index 9e355c45e..000000000 --- a/compilacao/migrations/0037_auto_20151224_1348.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0036_auto_20151224_1341'), - ] - - operations = [ - migrations.AlterField( - model_name='textoarticulado', - name='participacao_social', - field=models.NullBooleanField(verbose_name='Participação Social', choices=[(True, 'Sim'), (False, 'Não')], default=False), - ), - ] diff --git a/compilacao/migrations/0038_auto_20151224_1429.py b/compilacao/migrations/0038_auto_20151224_1429.py deleted file mode 100644 index 0e73bb987..000000000 --- a/compilacao/migrations/0038_auto_20151224_1429.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0037_auto_20151224_1348'), - ] - - operations = [ - migrations.AddField( - model_name='tipotextoarticulado', - name='participacao_social', - field=models.NullBooleanField(default=False, verbose_name='Participação Social', choices=[(True, 'Sim'), (False, 'Não')]), - ), - migrations.AlterField( - model_name='textoarticulado', - name='participacao_social', - field=models.NullBooleanField(default=None, verbose_name='Participação Social', choices=[(None, 'Padrão definido no Tipo'), (True, 'Sim'), (False, 'Não')]), - ), - ] diff --git a/compilacao/migrations/0039_auto_20151224_1846.py b/compilacao/migrations/0039_auto_20151224_1846.py deleted file mode 100644 index 51099c44f..000000000 --- a/compilacao/migrations/0039_auto_20151224_1846.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0038_auto_20151224_1429'), - ] - - operations = [ - migrations.AlterField( - model_name='textoarticulado', - name='tipo_ta', - field=models.ForeignKey(default=None, null=True, to='compilacao.TipoTextoArticulado', blank=True, verbose_name='Tipo de Texto Articulado'), - ), - ] diff --git a/compilacao/urls.py b/compilacao/urls.py index f6bde1928..15232998b 100644 --- a/compilacao/urls.py +++ b/compilacao/urls.py @@ -12,7 +12,7 @@ urlpatterns_compilacao = [ views.TaDeleteView.as_view(), name='ta_delete'), - url(r'^(?P[0-9]+)/text', + url(r'^(?P[0-9]+)/text$', views.TextoView.as_view(), name='ta_text'), url(r'^(?P[0-9]+)/text/vigencia/(?P.+)/$', views.TextoView.as_view(), name='ta_vigencia'), diff --git a/materia/urls.py b/materia/urls.py index 17cff8167..f081515a8 100644 --- a/materia/urls.py +++ b/materia/urls.py @@ -19,7 +19,6 @@ from materia.views import (AutoriaEditView, AutoriaView, materia_legislativa_patterns = materia_legislativa_crud.urlpatterns -# + __url__compilacao urlpatterns = [ diff --git a/norma/migrations/0009_auto_20151224_1637.py b/norma/migrations/0009_auto_20151224_1637.py deleted file mode 100644 index 5de7416b2..000000000 --- a/norma/migrations/0009_auto_20151224_1637.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('compilacao', '0038_auto_20151224_1429'), - ('norma', '0008_normajuridica_texto_integral'), - ] - - operations = [ - migrations.AlterModelOptions( - name='normajuridica', - options={'verbose_name': 'Norma Jurídica', 'verbose_name_plural': 'Normas Jurídicas'}, - ), - migrations.RemoveField( - model_name='normajuridica', - name='ano', - ), - migrations.RemoveField( - model_name='normajuridica', - name='data', - ), - migrations.RemoveField( - model_name='normajuridica', - name='ementa', - ), - migrations.RemoveField( - model_name='normajuridica', - name='id', - ), - migrations.RemoveField( - model_name='normajuridica', - name='numero', - ), - migrations.RemoveField( - model_name='normajuridica', - name='observacao', - ), - migrations.AddField( - model_name='normajuridica', - name='textoarticulado_ptr', - field=models.OneToOneField(to='compilacao.TextoArticulado', primary_key=True, parent_link=True, auto_created=True, default=1, serialize=False), - preserve_default=False, - ), - ] diff --git a/norma/models.py b/norma/models.py index cbbe1aeb4..66aefee18 100644 --- a/norma/models.py +++ b/norma/models.py @@ -2,7 +2,6 @@ from django.db import models from django.template import defaultfilters from django.utils.translation import ugettext_lazy as _ -from compilacao.models import TextoArticulado from materia.models import MateriaLegislativa from sapl.utils import YES_NO_CHOICES, make_choices @@ -62,7 +61,7 @@ def texto_upload_path(instance, filename): return get_norma_media_path(instance, instance.ano, filename) -class NormaJuridica(TextoArticulado): +class NormaJuridica(models.Model): ESFERA_FEDERACAO_CHOICES, ESTADUAL, FEDERAL, MUNICIPAL = make_choices( 'E', _('Estadual'), 'F', _('Federal'), @@ -75,10 +74,13 @@ class NormaJuridica(TextoArticulado): verbose_name=_('Texto Integral')) tipo = models.ForeignKey(TipoNormaJuridica, verbose_name=_('Tipo')) materia = models.ForeignKey(MateriaLegislativa, blank=True, null=True) + numero = models.PositiveIntegerField(verbose_name=_('Número')) + ano = models.PositiveSmallIntegerField(verbose_name=_('Ano')) esfera_federacao = models.CharField( max_length=1, verbose_name=_('Esfera Federação'), choices=ESFERA_FEDERACAO_CHOICES) + data = models.DateField(blank=True, null=True, verbose_name=_('Data')) data_publicacao = models.DateField( blank=True, null=True, verbose_name=_('Data Publicação')) veiculo_publicacao = models.CharField( @@ -90,8 +92,11 @@ class NormaJuridica(TextoArticulado): blank=True, null=True, verbose_name=_('Pg. Início')) pagina_fim_publicacao = models.PositiveIntegerField( blank=True, null=True, verbose_name=_('Pg. Fim')) + ementa = models.TextField(verbose_name=_('Ementa')) indexacao = models.TextField( blank=True, null=True, verbose_name=_('Indexação')) + observacao = models.TextField( + blank=True, null=True, verbose_name=_('Observação')) complemento = models.NullBooleanField( blank=True, verbose_name=_('Complementar ?'), choices=YES_NO_CHOICES) @@ -105,6 +110,7 @@ class NormaJuridica(TextoArticulado): class Meta: verbose_name = _('Norma Jurídica') verbose_name_plural = _('Normas Jurídicas') + ordering = ['-data', '-numero'] def __str__(self): return _('%(tipo)s nº %(numero)s de %(data)s') % { diff --git a/norma/urls.py b/norma/urls.py index 5d22d640e..fb3110513 100644 --- a/norma/urls.py +++ b/norma/urls.py @@ -5,7 +5,7 @@ from norma.views import (NormaIncluirView, assunto_norma_crud, norma_temporario_crud, tipo_norma_crud) -norma_url_patterns = norma_temporario_crud.urlpatterns + __url__compilacao +norma_url_patterns = norma_temporario_crud.urlpatterns # norma_url_patterns = norma_crud.urlpatterns + [] urlpatterns = [ diff --git a/sapl/settings.py b/sapl/settings.py index c3971715d..d2de6e1c1 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -105,7 +105,7 @@ WSGI_APPLICATION = 'sapl.wsgi.application' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'sapl', + 'NAME': 'sapl_temp2_compilacao', 'USER': 'sapl', 'PASSWORD': 'sapl', 'HOST': 'localhost', diff --git a/templates/compilacao/text_list_bloco.html b/templates/compilacao/text_list_bloco.html index c07b56d01..26f908d46 100644 --- a/templates/compilacao/text_list_bloco.html +++ b/templates/compilacao/text_list_bloco.html @@ -152,9 +152,6 @@ {%endcomment%} {% endif %} - - - {% endfor %} {% endif %} @@ -163,7 +160,7 @@ {% endspaceless %} {% if view.is_ta_alterador and dpt.tipo_dispositivo.class_css == 'bloco_alteracao'%} - {%with node=dpt template_name='compilacao/texto_list_blocoalteracao.html' %} + {%with node=dpt template_name='compilacao/text_list_blocoalteracao.html' %} {%include template_name%} {%endwith%} {% endif%}