From 9824a253275d4d4e81abddfba0625d219016f119 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Wed, 31 Aug 2016 13:00:10 -0300 Subject: [PATCH] Add tela relatorias em parlamentar --- sapl/parlamentares/urls.py | 4 +++- sapl/parlamentares/views.py | 20 +++++++++++++++++++- sapl/templates/parlamentares/subnav.yaml | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/sapl/parlamentares/urls.py b/sapl/parlamentares/urls.py index c08d2639e..97f2a0347 100644 --- a/sapl/parlamentares/urls.py +++ b/sapl/parlamentares/urls.py @@ -7,6 +7,7 @@ from sapl.parlamentares.views import (CargoMesaCrud, ColigacaoCrud, NivelInstrucaoCrud, ParlamentarCrud, ParticipacaoParlamentarCrud, PartidoCrud, ProposicaoParlamentarCrud, + RelatoriaParlamentarCrud, SessaoLegislativaCrud, TipoAfastamentoCrud, TipoDependenteCrud, TipoMilitarCrud) @@ -20,7 +21,8 @@ urlpatterns = [ ParlamentarCrud.get_urls() + DependenteCrud.get_urls() + FiliacaoCrud.get_urls() + MandatoCrud.get_urls() + ParticipacaoParlamentarCrud.get_urls() + - ProposicaoParlamentarCrud.get_urls() + ProposicaoParlamentarCrud.get_urls() + + RelatoriaParlamentarCrud.get_urls() )), url(r'^coligacao/', include(ColigacaoCrud.get_urls() + diff --git a/sapl/parlamentares/views.py b/sapl/parlamentares/views.py index 837059cd9..0f2a8edfb 100644 --- a/sapl/parlamentares/views.py +++ b/sapl/parlamentares/views.py @@ -14,7 +14,7 @@ from sapl.crud.base import (Crud, CrudBaseMixin, CrudCreateView, CrudDeleteView, CrudDetailView, CrudListView, CrudUpdateView) from sapl.crud.masterdetail import MasterDetailCrud -from sapl.materia.models import Proposicao +from sapl.materia.models import Proposicao, Relatoria from sapl.utils import permissao_tb_aux, permissoes_parlamentares from .forms import (ComposicaoColigacaoForm, FiliacaoForm, LegislaturaForm, @@ -25,6 +25,24 @@ from .models import (CargoMesa, Coligacao, ComposicaoColigacao, ComposicaoMesa, SituacaoMilitar, TipoAfastamento, TipoDependente) +class RelatoriaParlamentarCrud(MasterDetailCrud): + model = Relatoria + parent_field = 'parlamentar' + help_path = '' + + class ListView(MasterDetailCrud.ListView): + permission_required = permissoes_parlamentares() + + class CreateView(PermissionRequiredMixin, MasterDetailCrud.CreateView): + permission_required = permissoes_parlamentares() + + class UpdateView(PermissionRequiredMixin, MasterDetailCrud.UpdateView): + permission_required = permissoes_parlamentares() + + class DeleteView(PermissionRequiredMixin, MasterDetailCrud.DeleteView): + permission_required = permissoes_parlamentares() + + class ProposicaoParlamentarCrud(MasterDetailCrud): model = Proposicao parent_field = 'autor__parlamentar' diff --git a/sapl/templates/parlamentares/subnav.yaml b/sapl/templates/parlamentares/subnav.yaml index a82cf68f8..286e0fc9d 100644 --- a/sapl/templates/parlamentares/subnav.yaml +++ b/sapl/templates/parlamentares/subnav.yaml @@ -11,3 +11,5 @@ url: participacao_list - title: {% trans 'Proposições' %} url: proposicao_list +- title: {% trans 'Relatorias' %} + url: relatoria_list