diff --git a/sapl/norma/migrations/0023_auto_20161123_1359.py b/sapl/norma/migrations/0023_auto_20161123_1359.py new file mode 100644 index 000000000..450071cc8 --- /dev/null +++ b/sapl/norma/migrations/0023_auto_20161123_1359.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-11-23 13:59 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('norma', '0022_auto_20161110_0910'), + ] + + operations = [ + migrations.AlterModelOptions( + name='vinculonormajuridica', + options={'verbose_name': 'Tipo de Vínculo entre Normas Jurídicas', 'verbose_name_plural': 'Tipos de Vínculos entre Normas Jurídicas'}, + ), + migrations.RemoveField( + model_name='vinculonormajuridica', + name='norma_referente', + ), + migrations.RemoveField( + model_name='vinculonormajuridica', + name='norma_referida', + ), + migrations.RemoveField( + model_name='vinculonormajuridica', + name='tipo_vinculo', + ), + migrations.AddField( + model_name='vinculonormajuridica', + name='descricao', + field=models.CharField(blank=True, max_length=20, verbose_name='Descrição'), + ), + migrations.AddField( + model_name='vinculonormajuridica', + name='sigla', + field=models.CharField(blank=True, max_length=1, verbose_name='Nome'), + ), + ] diff --git a/sapl/norma/migrations/0024_auto_20161123_1430.py b/sapl/norma/migrations/0024_auto_20161123_1430.py new file mode 100644 index 000000000..e531c2a38 --- /dev/null +++ b/sapl/norma/migrations/0024_auto_20161123_1430.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-11-23 14:30 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('norma', '0023_auto_20161123_1359'), + ] + + operations = [ + migrations.AlterField( + model_name='vinculonormajuridica', + name='descricao', + field=models.CharField(blank=True, max_length=50, verbose_name='Descrição'), + ), + migrations.AlterField( + model_name='vinculonormajuridica', + name='sigla', + field=models.CharField(blank=True, max_length=1, verbose_name='Sigla'), + ), + ] diff --git a/sapl/norma/models.py b/sapl/norma/models.py index debbdadc9..484ccd99d 100644 --- a/sapl/norma/models.py +++ b/sapl/norma/models.py @@ -171,37 +171,14 @@ class LegislacaoCitada(models.Model): class VinculoNormaJuridica(models.Model): - TIPO_VINCULO_CHOICES = ( - ('A', _('Altera a norma')), - ('R', _('Revoga integralmente a norma')), - ('P', _('Revoga parcialmente a norma')), - ('T', _('Revoga integralmente por consolidação')), - ('C', _('Norma correlata')), - ('S', _('Ressalva a norma')), - ('E', _('Reedita a norma')), - ('I', _('Reedita a norma com alteração')), - ('G', _('Regulamenta a norma')), - ('K', _('Suspende parcialmente a norma')), - ('L', _('Suspende integralmente a norma')), - ('N', _('Julgada integralmente inconstitucional')), - ('O', _('Julgada parcialmente inconstitucional')), - ) - - # TODO M2M ??? - norma_referente = models.ForeignKey( - NormaJuridica, related_name='norma_referente_set') - norma_referida = models.ForeignKey( - NormaJuridica, related_name='norma_referida_set') - tipo_vinculo = models.CharField( - max_length=1, blank=True, choices=TIPO_VINCULO_CHOICES) + sigla = models.CharField( + max_length=1, blank=True, verbose_name=_('Sigla')) + descricao = models.CharField( + max_length=50, blank=True, verbose_name=_('Descrição')) class Meta: - verbose_name = _('Vínculo entre Normas Jurídicas') - verbose_name_plural = _('Vínculos entre Normas Jurídicas') + verbose_name = _('Tipo de Vínculo entre Normas Jurídicas') + verbose_name_plural = _('Tipos de Vínculos entre Normas Jurídicas') def __str__(self): - return _('Referente: %(referente)s \n' - 'Referida: %(referida)s \nVínculo: %(vinculo)s') % { - 'referente': self.norma_referente, - 'referida': self.norma_referida, - 'vinculo': self.tipo_vinculo} + return self.descricao diff --git a/sapl/norma/urls.py b/sapl/norma/urls.py index 8c261e23e..dfbc34f83 100644 --- a/sapl/norma/urls.py +++ b/sapl/norma/urls.py @@ -1,7 +1,8 @@ from django.conf.urls import include, url from sapl.norma.views import (AssuntoNormaCrud, NormaCrud, NormaPesquisaView, - TipoNormaCrud, NormaTaView) + NormaTaView, TipoNormaCrud, + VinculoNormaJuridicaCrud) from .apps import AppConfig @@ -16,6 +17,8 @@ urlpatterns = [ url(r'^sistema/norma/tipo/', include(TipoNormaCrud.get_urls())), url(r'^sistema/norma/assunto/', include(AssuntoNormaCrud.get_urls())), + url(r'^sistema/norma/vinculo/', include( + VinculoNormaJuridicaCrud.get_urls())), url(r'^norma/pesquisar$', NormaPesquisaView.as_view(), name='norma_pesquisa'), diff --git a/sapl/norma/views.py b/sapl/norma/views.py index 5a0dc283a..610e4ba64 100644 --- a/sapl/norma/views.py +++ b/sapl/norma/views.py @@ -13,7 +13,8 @@ from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux, MasterDetailCrud, make_pagination) from .forms import NormaFilterSet, NormaJuridicaForm -from .models import AssuntoNorma, NormaJuridica, TipoNormaJuridica +from .models import (AssuntoNorma, NormaJuridica, TipoNormaJuridica, + VinculoNormaJuridica) # LegislacaoCitadaCrud = Crud.build(LegislacaoCitada, '') AssuntoNormaCrud = CrudAux.build(AssuntoNorma, 'assunto_norma_juridica', @@ -23,6 +24,8 @@ AssuntoNormaCrud = CrudAux.build(AssuntoNorma, 'assunto_norma_juridica', TipoNormaCrud = CrudAux.build( TipoNormaJuridica, 'tipo_norma_juridica', list_field_names=['sigla', 'descricao', 'equivalente_lexml']) +VinculoNormaJuridicaCrud = CrudAux.build( + VinculoNormaJuridica, '', list_field_names=['sigla', 'descricao']) class NormaPesquisaView(FilterView): diff --git a/sapl/templates/norma/layouts.yaml b/sapl/templates/norma/layouts.yaml index 99e14640c..a00f1d5d3 100644 --- a/sapl/templates/norma/layouts.yaml +++ b/sapl/templates/norma/layouts.yaml @@ -49,3 +49,7 @@ LegislacaoCitadaDetail: - disposicoes parte livro titulo - capitulo secao subsecao artigo - paragrafo inciso alinea item + +VinculoNormaJuridica: + {% trans 'Tipo de Vínculo entre Normas Jurídicas' %}: + - sigla:2 descricao diff --git a/sapl/templates/sistema.html b/sapl/templates/sistema.html index 9db02b417..6b9d1f5d4 100644 --- a/sapl/templates/sistema.html +++ b/sapl/templates/sistema.html @@ -70,7 +70,8 @@

Módulo Normas Jurídicas

Tipo de Norma Jurídica
-
Assunto de Norma Jurídica
+
Assunto de Norma Jurídica
+
Tipo de Vínculo