From bde2bfa9692cde4560a8a863716f49485ec70f03 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Tue, 21 Mar 2017 11:47:34 -0300 Subject: [PATCH] Fix #909 --- sapl/materia/forms.py | 4 ---- .../migrations/0077_auto_20170321_1130.py | 21 +++++++++++++++++++ sapl/materia/models.py | 2 +- sapl/materia/views.py | 8 +++++-- .../migrations/0014_auto_20170321_1130.py | 21 +++++++++++++++++++ 5 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 sapl/materia/migrations/0077_auto_20170321_1130.py create mode 100644 sapl/protocoloadm/migrations/0014_auto_20170321_1130.py diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index e93f9fe6d..951a8ed7c 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -190,10 +190,6 @@ class RelatoriaForm(ModelForm): def __init__(self, *args, **kwargs): super(RelatoriaForm, self).__init__(*args, **kwargs) - self.fields['parlamentar'].queryset = Parlamentar.objects.filter( - ativo=True, id__in=Participacao.objects.filter( - composicao_id=self.initial['comissao'] - ).values_list('parlamentar_id')).order_by('nome_completo') def clean(self): cleaned_data = self.cleaned_data diff --git a/sapl/materia/migrations/0077_auto_20170321_1130.py b/sapl/materia/migrations/0077_auto_20170321_1130.py new file mode 100644 index 000000000..a39b48c1d --- /dev/null +++ b/sapl/materia/migrations/0077_auto_20170321_1130.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2017-03-21 11:30 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('materia', '0076_merge'), + ] + + operations = [ + migrations.AlterField( + model_name='relatoria', + name='comissao', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='comissoes.Comissao', verbose_name='Comissão'), + ), + ] diff --git a/sapl/materia/models.py b/sapl/materia/models.py index 02b63840a..488a4e555 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -489,7 +489,7 @@ class Relatoria(models.Model): null=True, verbose_name=_('Motivo Fim Relatoria')) comissao = models.ForeignKey( - Comissao, blank=True, null=True, verbose_name=_('Localização Atual')) + Comissao, blank=True, null=True, verbose_name=_('Comissão')) data_designacao_relator = models.DateField( verbose_name=_('Data Designação')) data_destituicao_relator = models.DateField( diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 594ae1a56..8a401b079 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -47,8 +47,8 @@ from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, AdicionarVariasAutoriasFilterSet, DespachoInicialForm, DocumentoAcessorioForm, MateriaLegislativaFilterSet, MateriaSimplificadaForm, PrimeiraTramitacaoEmLoteFilterSet, - ReceberProposicaoForm, TramitacaoEmLoteFilterSet, - filtra_tramitacao_destino, + ReceberProposicaoForm, RelatoriaForm, + TramitacaoEmLoteFilterSet, filtra_tramitacao_destino, filtra_tramitacao_destino_and_status, filtra_tramitacao_status) from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial, @@ -808,6 +808,7 @@ class RelatoriaCrud(MasterDetailCrud): public = [RP_LIST, RP_DETAIL] class CreateView(MasterDetailCrud.CreateView): + form_class = RelatoriaForm def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) @@ -848,6 +849,9 @@ class RelatoriaCrud(MasterDetailCrud): return {'comissao': localizacao} + class UpdateView(MasterDetailCrud.UpdateView): + form_class = RelatoriaForm + class TramitacaoCrud(MasterDetailCrud): model = Tramitacao diff --git a/sapl/protocoloadm/migrations/0014_auto_20170321_1130.py b/sapl/protocoloadm/migrations/0014_auto_20170321_1130.py new file mode 100644 index 000000000..661d7242b --- /dev/null +++ b/sapl/protocoloadm/migrations/0014_auto_20170321_1130.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2017-03-21 11:30 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('protocoloadm', '0013_auto_20170320_1637'), + ] + + operations = [ + migrations.AlterField( + model_name='documentoadministrativo', + name='protocolo', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.Protocolo', verbose_name='Protocolo'), + ), + ]