From 26141274a881b0c48cc96867e4ac433a34165d1b Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Mon, 19 Sep 2016 09:11:59 -0300 Subject: [PATCH] Cria view para Bloco --- sapl/sessao/urls.py | 9 ++++++--- sapl/sessao/views.py | 23 +++++++++++++++++------ sapl/templates/sessao/layouts.yaml | 7 +++++++ sapl/templates/sistema.html | 3 ++- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/sapl/sessao/urls.py b/sapl/sessao/urls.py index 0c1a5c424..16231d881 100644 --- a/sapl/sessao/urls.py +++ b/sapl/sessao/urls.py @@ -2,9 +2,10 @@ from django.conf.urls import include, url from sapl.sessao.views import (AdicionarVariasMateriasExpediente, AdicionarVariasMateriasOrdemDia, BancadaCrud, - CargoBancadaCrud, ExpedienteMateriaCrud, - ExpedienteView, MateriaOrdemDiaCrud, MesaView, - OradorCrud, OradorExpedienteCrud, PainelView, + BlocoCrud, CargoBancadaCrud, + ExpedienteMateriaCrud, ExpedienteView, + MateriaOrdemDiaCrud, MesaView, OradorCrud, + OradorExpedienteCrud, PainelView, PautaExpedienteDetail, PautaOrdemDetail, PautaSessaoDetailView, PautaSessaoListView, PesquisarSessaoPlenariaView, @@ -55,6 +56,8 @@ urlpatterns = [ include(TipoExpedienteCrud.get_urls())), url(r'^sistema/bancada/', include(BancadaCrud.get_urls())), + url(r'^sistema/bloco/', + include(BlocoCrud.get_urls())), url(r'^sistema/cargo-bancada/', include(CargoBancadaCrud.get_urls())), url(r'^sessao/(?P\d+)/adicionar-varias-materias-expediente/', diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index d4f06f615..b51000a2e 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -32,12 +32,12 @@ from .forms import (AdicionarVariasMateriasFilterSet, BancadaForm, MesaForm, OrdemDiaForm, PresencaForm, SessaoPlenariaFilterSet, VotacaoEditForm, VotacaoForm, VotacaoNominalForm) -from .models import (Bancada, CargoBancada, CargoMesa, ExpedienteMateria, - ExpedienteSessao, IntegranteMesa, MateriaLegislativa, - Orador, OradorExpediente, OrdemDia, PresencaOrdemDia, - RegistroVotacao, SessaoPlenaria, SessaoPlenariaPresenca, - TipoExpediente, TipoResultadoVotacao, TipoSessaoPlenaria, - VotoParlamentar) +from .models import (Bancada, Bloco, CargoBancada, CargoMesa, + ExpedienteMateria, ExpedienteSessao, IntegranteMesa, + MateriaLegislativa, Orador, OradorExpediente, OrdemDia, + PresencaOrdemDia, RegistroVotacao, SessaoPlenaria, + SessaoPlenariaPresenca, TipoExpediente, + TipoResultadoVotacao, TipoSessaoPlenaria, VotoParlamentar) OrdemDiaCrud = Crud.build(OrdemDia, '') RegistroVotacaoCrud = Crud.build(RegistroVotacao, '') @@ -69,6 +69,17 @@ def reordernar_materias_ordem(request, pk): reverse('sapl.sessao:ordemdia_list', kwargs={'pk': pk})) +class BlocoCrud(Crud): + model = Bloco + help_path = '' + + class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): + list_field_names = ['nome', 'data_criacao', 'bancadas'] + + def has_permission(self): + return permissao_tb_aux(self) + + class BancadaCrud(Crud): model = Bancada help_path = '' diff --git a/sapl/templates/sessao/layouts.yaml b/sapl/templates/sessao/layouts.yaml index a99e224f8..b92333de1 100644 --- a/sapl/templates/sessao/layouts.yaml +++ b/sapl/templates/sessao/layouts.yaml @@ -70,3 +70,10 @@ Bancada: CargoBancada: {% trans 'Cargo de Bancada' %}: - nome_cargo:8 cargo_unico + +Bloco: + {% trans 'Bloco' %}: + - nome + - data_criacao data_extincao + - bancadas + - descricao diff --git a/sapl/templates/sistema.html b/sapl/templates/sistema.html index 3ea597111..e625d3a9e 100644 --- a/sapl/templates/sistema.html +++ b/sapl/templates/sistema.html @@ -40,7 +40,8 @@