From 19d44d674635b03ce9c0c0a6801afbe6ce68ebbe Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Thu, 29 Sep 2016 12:01:19 -0300 Subject: [PATCH 1/6] Adiciona comando migracao_25_31 ao manage.py Signed-off-by: Luciano Almeida --- sapl/legacy/management/__init__.py | 0 sapl/legacy/management/commands/__init__.py | 0 sapl/legacy/management/commands/migracao_25_31.py | 9 +++++++++ 3 files changed, 9 insertions(+) create mode 100644 sapl/legacy/management/__init__.py create mode 100644 sapl/legacy/management/commands/__init__.py create mode 100644 sapl/legacy/management/commands/migracao_25_31.py diff --git a/sapl/legacy/management/__init__.py b/sapl/legacy/management/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/sapl/legacy/management/commands/__init__.py b/sapl/legacy/management/commands/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/sapl/legacy/management/commands/migracao_25_31.py b/sapl/legacy/management/commands/migracao_25_31.py new file mode 100644 index 000000000..199075d44 --- /dev/null +++ b/sapl/legacy/management/commands/migracao_25_31.py @@ -0,0 +1,9 @@ +from django.core.management.base import BaseCommand +from sapl.legacy import migration + + +class Command(BaseCommand): + help = u'Faz a migração de dados do SAPL 2.5 para o SAPL 3.1' + + def handle(self, *args, **options): + migration.migrate() From e4c3ce032de10d8e1f238f4ad62351a944545d5b Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Thu, 29 Sep 2016 13:53:04 -0300 Subject: [PATCH 2/6] Fix #662 --- sapl/materia/forms.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index cce976e88..1d481cce1 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -17,6 +17,7 @@ from sapl.comissoes.models import Comissao from sapl.crispy_layout_mixin import form_actions, to_row from sapl.norma.models import (LegislacaoCitada, NormaJuridica, TipoNormaJuridica) +from sapl.parlamentares.models import Parlamentar from sapl.settings import MAX_DOC_UPLOAD_SIZE from sapl.utils import (RANGE_ANOS, RangeWidgetOverride, autor_label, autor_modal) @@ -190,6 +191,11 @@ class RelatoriaForm(ModelForm): widgets = {'comissao': forms.Select(attrs={'disabled': 'disabled'})} + def __init__(self, *args, **kwargs): + super(RelatoriaForm, self).__init__(*args, **kwargs) + self.fields['parlamentar'].queryset = Parlamentar.objects.filter( + ativo=True).order_by('nome_completo') + def clean(self): cleaned_data = self.cleaned_data From 458f65395e871479a49cffd7d831b1b52e0e5f60 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Thu, 29 Sep 2016 14:49:34 -0300 Subject: [PATCH 3/6] Fix #659 --- sapl/materia/urls.py | 4 ++- sapl/materia/views.py | 14 ++++++++++- .../materia/materialegislativa_form.html | 25 +++++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 sapl/templates/materia/materialegislativa_form.html diff --git a/sapl/materia/urls.py b/sapl/materia/urls.py index 8ffe63f86..5da2305bb 100644 --- a/sapl/materia/urls.py +++ b/sapl/materia/urls.py @@ -19,7 +19,7 @@ from sapl.materia.views import (AcompanhamentoConfirmarView, TipoDocumentoCrud, TipoFimRelatoriaCrud, TipoMateriaCrud, TipoProposicaoCrud, TramitacaoCrud, TramitacaoEmLoteView, - UnidadeTramitacaoCrud) + UnidadeTramitacaoCrud, recuperar_materia) from .apps import AppConfig @@ -36,6 +36,8 @@ urlpatterns = [ RelatoriaCrud.get_urls() + DocumentoAcessorioCrud.get_urls())), + url(r'^materia/recuperar-materia', recuperar_materia), + url(r'''^confirmar/(?P[0-9A-Za-z_\-]+)/ (?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})$''', ConfirmarEmailView.as_view(), name='confirmar_email'), diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 2b639fafa..0425c6b15 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -13,6 +13,7 @@ from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist from django.core.mail import send_mail from django.core.urlresolvers import reverse from django.db.models import Q +from django.http import JsonResponse from django.http.response import HttpResponseRedirect from django.shortcuts import redirect from django.template import Context, loader @@ -54,10 +55,21 @@ from .models import (AcompanhamentoMateria, Anexada, Autor, Autoria, TipoFimRelatoria, TipoMateriaLegislativa, TipoProposicao, Tramitacao, UnidadeTramitacao) - AnexadaCrud = Crud.build(Anexada, '') +def recuperar_materia(request): + tipo = TipoMateriaLegislativa.objects.get(pk=request.GET['tipo']) + materia = MateriaLegislativa.objects.filter(tipo=tipo).last() + if materia: + response = JsonResponse({'numero': materia.numero + 1, + 'ano': datetime.now().year}) + else: + response = JsonResponse({'numero': 1, 'ano': datetime.now().year}) + + return response + + class OrigemCrud(Crud): model = Origem help_path = 'origem' diff --git a/sapl/templates/materia/materialegislativa_form.html b/sapl/templates/materia/materialegislativa_form.html new file mode 100644 index 000000000..7cb127605 --- /dev/null +++ b/sapl/templates/materia/materialegislativa_form.html @@ -0,0 +1,25 @@ +{% extends "crud/form.html" %} +{% load i18n %} +{% load crispy_forms_tags %} +{% load common_tags %} + +{% block extra_js %} + + + +{% endblock %} From 4a71b8010b76c3783ab4a2dd04b6c0c9080200e3 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Thu, 29 Sep 2016 15:27:03 -0300 Subject: [PATCH 4/6] Fix #665 --- sapl/templates/materia/relatoria_form.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 sapl/templates/materia/relatoria_form.html diff --git a/sapl/templates/materia/relatoria_form.html b/sapl/templates/materia/relatoria_form.html new file mode 100644 index 000000000..953557513 --- /dev/null +++ b/sapl/templates/materia/relatoria_form.html @@ -0,0 +1,14 @@ +{% extends "crud/form.html" %} +{% load i18n %} +{% load crispy_forms_tags %} +{% load common_tags %} + +{% block base_content %} + {% if form.comissao.value == 0 %} + + {% else %} + {% crispy form %} + {% endif %} +{% endblock %} From bc4c7877859b7d1282e121575337c8bb5f7e8c86 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Thu, 29 Sep 2016 16:35:41 -0300 Subject: [PATCH 5/6] =?UTF-8?q?Conserta=20verbose=20name=20do=20model=20de?= =?UTF-8?q?=20Legisla=C3=A7=C3=A3o=20Citada?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0015_auto_20160929_1635.py | 19 +++++++++++++++++++ sapl/norma/models.py | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 sapl/norma/migrations/0015_auto_20160929_1635.py diff --git a/sapl/norma/migrations/0015_auto_20160929_1635.py b/sapl/norma/migrations/0015_auto_20160929_1635.py new file mode 100644 index 000000000..5ea7f8a1b --- /dev/null +++ b/sapl/norma/migrations/0015_auto_20160929_1635.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-29 19:35 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('norma', '0014_merge'), + ] + + operations = [ + migrations.AlterModelOptions( + name='legislacaocitada', + options={'verbose_name': 'Legislação', 'verbose_name_plural': 'Legislações'}, + ), + ] diff --git a/sapl/norma/models.py b/sapl/norma/models.py index 8c47d4c72..c03c4c305 100644 --- a/sapl/norma/models.py +++ b/sapl/norma/models.py @@ -164,8 +164,8 @@ class LegislacaoCitada(models.Model): max_length=3, blank=True, verbose_name=_('Item')) class Meta: - verbose_name = _('Matéria Legislativa') - verbose_name_plural = _('Matérias Legislativas') + verbose_name = _('Legislação') + verbose_name_plural = _('Legislações') class VinculoNormaJuridica(models.Model): From 849640ce267c1d30c77bbcf53254c00383b71367 Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Thu, 29 Sep 2016 17:08:16 -0300 Subject: [PATCH 6/6] Arruma legacy.yml de Legislatura de Parlamentares Signed-off-by: Luciano Almeida --- sapl/parlamentares/legacy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/sapl/parlamentares/legacy.yaml b/sapl/parlamentares/legacy.yaml index 3130c548f..738656e4e 100644 --- a/sapl/parlamentares/legacy.yaml +++ b/sapl/parlamentares/legacy.yaml @@ -1,4 +1,5 @@ Legislatura: + numero: num_legislatura data_eleicao: dat_eleicao data_fim: dat_fim data_inicio: dat_inicio