diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 02e9d030b..782f74201 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -31,12 +31,13 @@ from sapl.crud.base import (ACTION_CREATE, ACTION_DELETE, ACTION_DETAIL, ACTION_LIST, ACTION_UPDATE, RP_DETAIL, RP_LIST, Crud, CrudAux, CrudDetailView, MasterDetailCrud, make_pagination) +from sapl.materia import apps from sapl.materia.forms import AnexadaForm, LegislacaoCitadaForm from sapl.norma.models import LegislacaoCitada from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label, autor_modal, gerar_hash_arquivo, get_base_url, permissoes_autor, permissoes_materia, - permissoes_protocoloadm) + permissoes_protocoloadm, permission_required_for_app) from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, AutorForm, ConfirmarProposicaoForm, DocumentoAcessorioForm, @@ -53,6 +54,7 @@ from .models import (AcompanhamentoMateria, Anexada, Autor, Autoria, TipoFimRelatoria, TipoMateriaLegislativa, TipoProposicao, Tramitacao, UnidadeTramitacao) + OrigemCrud = Crud.build(Origem, '') TipoMateriaCrud = CrudAux.build( @@ -103,6 +105,7 @@ class ProposicaoTaView(IntegracaoTaView): return self.get_redirect_deactivated() +@permission_required_for_app(app_label=apps.AppConfig.label) def recuperar_materia(request): tipo = TipoMateriaLegislativa.objects.get(pk=request.GET['tipo']) materia = MateriaLegislativa.objects.filter(tipo=tipo).last() diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index c4a9da917..3f8fe93af 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -16,7 +16,6 @@ from django.views.generic.base import RedirectView from django.views.generic.detail import DetailView from django.views.generic.edit import FormMixin from django_filters.views import FilterView -from rest_framework import generics from sapl.base.models import AppConfig as AppsAppConfig from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux, @@ -29,6 +28,7 @@ from sapl.materia.views import MateriaLegislativaPesquisaView from sapl.norma.models import NormaJuridica from sapl.parlamentares.models import (Legislatura, Parlamentar, SessaoLegislativa) +from sapl.sessao import apps from sapl.sessao.apps import AppConfig from sapl.sessao.forms import ExpedienteMateriaForm, OrdemDiaForm from sapl.utils import permission_required_for_app @@ -45,6 +45,7 @@ from .models import (Bancada, Bloco, CargoBancada, CargoMesa, SessaoPlenariaPresenca, TipoExpediente, TipoResultadoVotacao, TipoSessaoPlenaria, VotoParlamentar) + TipoSessaoCrud = CrudAux.build(TipoSessaoPlenaria, 'tipo_sessao_plenaria') TipoExpedienteCrud = CrudAux.build(TipoExpediente, 'tipo_expediente') CargoBancadaCrud = CrudAux.build(CargoBancada, '') @@ -83,6 +84,7 @@ def reordernar_materias_ordem(request, pk): reverse('sapl.sessao:ordemdia_list', kwargs={'pk': pk})) +@permission_required_for_app(app_label=apps.AppConfig.label) def abrir_votacao_expediente_view(request, pk, spk): existe_votacao_aberta = ExpedienteMateria.objects.filter( sessao_plenaria_id=spk, votacao_aberta=True @@ -99,6 +101,7 @@ def abrir_votacao_expediente_view(request, pk, spk): reverse('sapl.sessao:expedientemateria_list', kwargs={'pk': spk})) +@permission_required_for_app(app_label=apps.AppConfig.label) def abrir_votacao_ordem_view(request, pk, spk): existe_votacao_aberta = OrdemDia.objects.filter( sessao_plenaria_id=spk, votacao_aberta=True @@ -442,6 +445,7 @@ class SessaoCrud(Crud): return RedirectView.get(self, request, *args, **kwargs) class UpdateView(Crud.UpdateView): + def get_initial(self): return {'sessao_legislativa': self.object.sessao_legislativa}