Browse Source

Fix #731

pull/735/head
LeandroRoberto 8 years ago
parent
commit
f3bc901385
  1. 5
      sapl/materia/views.py
  2. 6
      sapl/sessao/views.py

5
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, ACTION_LIST, ACTION_UPDATE, RP_DETAIL, RP_LIST,
Crud, CrudAux, CrudDetailView, MasterDetailCrud, Crud, CrudAux, CrudDetailView, MasterDetailCrud,
make_pagination) make_pagination)
from sapl.materia import apps
from sapl.materia.forms import AnexadaForm, LegislacaoCitadaForm from sapl.materia.forms import AnexadaForm, LegislacaoCitadaForm
from sapl.norma.models import LegislacaoCitada from sapl.norma.models import LegislacaoCitada
from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label, from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label,
autor_modal, gerar_hash_arquivo, get_base_url, autor_modal, gerar_hash_arquivo, get_base_url,
permissoes_autor, permissoes_materia, permissoes_autor, permissoes_materia,
permissoes_protocoloadm) permissoes_protocoloadm, permission_required_for_app)
from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm,
AutorForm, ConfirmarProposicaoForm, DocumentoAcessorioForm, AutorForm, ConfirmarProposicaoForm, DocumentoAcessorioForm,
@ -53,6 +54,7 @@ from .models import (AcompanhamentoMateria, Anexada, Autor, Autoria,
TipoFimRelatoria, TipoMateriaLegislativa, TipoProposicao, TipoFimRelatoria, TipoMateriaLegislativa, TipoProposicao,
Tramitacao, UnidadeTramitacao) Tramitacao, UnidadeTramitacao)
OrigemCrud = Crud.build(Origem, '') OrigemCrud = Crud.build(Origem, '')
TipoMateriaCrud = CrudAux.build( TipoMateriaCrud = CrudAux.build(
@ -103,6 +105,7 @@ class ProposicaoTaView(IntegracaoTaView):
return self.get_redirect_deactivated() return self.get_redirect_deactivated()
@permission_required_for_app(app_label=apps.AppConfig.label)
def recuperar_materia(request): def recuperar_materia(request):
tipo = TipoMateriaLegislativa.objects.get(pk=request.GET['tipo']) tipo = TipoMateriaLegislativa.objects.get(pk=request.GET['tipo'])
materia = MateriaLegislativa.objects.filter(tipo=tipo).last() materia = MateriaLegislativa.objects.filter(tipo=tipo).last()

6
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.detail import DetailView
from django.views.generic.edit import FormMixin from django.views.generic.edit import FormMixin
from django_filters.views import FilterView from django_filters.views import FilterView
from rest_framework import generics
from sapl.base.models import AppConfig as AppsAppConfig from sapl.base.models import AppConfig as AppsAppConfig
from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud, CrudAux, 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.norma.models import NormaJuridica
from sapl.parlamentares.models import (Legislatura, Parlamentar, from sapl.parlamentares.models import (Legislatura, Parlamentar,
SessaoLegislativa) SessaoLegislativa)
from sapl.sessao import apps
from sapl.sessao.apps import AppConfig from sapl.sessao.apps import AppConfig
from sapl.sessao.forms import ExpedienteMateriaForm, OrdemDiaForm from sapl.sessao.forms import ExpedienteMateriaForm, OrdemDiaForm
from sapl.utils import permission_required_for_app from sapl.utils import permission_required_for_app
@ -45,6 +45,7 @@ from .models import (Bancada, Bloco, CargoBancada, CargoMesa,
SessaoPlenariaPresenca, TipoExpediente, SessaoPlenariaPresenca, TipoExpediente,
TipoResultadoVotacao, TipoSessaoPlenaria, VotoParlamentar) TipoResultadoVotacao, TipoSessaoPlenaria, VotoParlamentar)
TipoSessaoCrud = CrudAux.build(TipoSessaoPlenaria, 'tipo_sessao_plenaria') TipoSessaoCrud = CrudAux.build(TipoSessaoPlenaria, 'tipo_sessao_plenaria')
TipoExpedienteCrud = CrudAux.build(TipoExpediente, 'tipo_expediente') TipoExpedienteCrud = CrudAux.build(TipoExpediente, 'tipo_expediente')
CargoBancadaCrud = CrudAux.build(CargoBancada, '') CargoBancadaCrud = CrudAux.build(CargoBancada, '')
@ -83,6 +84,7 @@ def reordernar_materias_ordem(request, pk):
reverse('sapl.sessao:ordemdia_list', kwargs={'pk': 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): def abrir_votacao_expediente_view(request, pk, spk):
existe_votacao_aberta = ExpedienteMateria.objects.filter( existe_votacao_aberta = ExpedienteMateria.objects.filter(
sessao_plenaria_id=spk, votacao_aberta=True 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})) 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): def abrir_votacao_ordem_view(request, pk, spk):
existe_votacao_aberta = OrdemDia.objects.filter( existe_votacao_aberta = OrdemDia.objects.filter(
sessao_plenaria_id=spk, votacao_aberta=True sessao_plenaria_id=spk, votacao_aberta=True
@ -442,6 +445,7 @@ class SessaoCrud(Crud):
return RedirectView.get(self, request, *args, **kwargs) return RedirectView.get(self, request, *args, **kwargs)
class UpdateView(Crud.UpdateView): class UpdateView(Crud.UpdateView):
def get_initial(self): def get_initial(self):
return {'sessao_legislativa': self.object.sessao_legislativa} return {'sessao_legislativa': self.object.sessao_legislativa}

Loading…
Cancel
Save