Browse Source

Finaliza a autenticacao do app parlamentares

pull/506/head
Eduardo Calil 9 years ago
parent
commit
fd00a77f54
  1. 14
      sapl/materia/views.py
  2. 53
      sapl/parlamentares/views.py

14
sapl/materia/views.py

@ -59,7 +59,6 @@ class OrigemCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_materia() permission_required = permissoes_materia()
list_field_names = ['nome', 'sigla']
class TipoMateriaCrud(Crud): class TipoMateriaCrud(Crud):
@ -68,7 +67,6 @@ class TipoMateriaCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_materia() permission_required = permissoes_materia()
list_field_names = ['sigla', 'descricao']
class RegimeTramitacaoCrud(Crud): class RegimeTramitacaoCrud(Crud):
@ -77,7 +75,6 @@ class RegimeTramitacaoCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_materia() permission_required = permissoes_materia()
list_field_names = ['descricao']
class TipoDocumentoCrud(Crud): class TipoDocumentoCrud(Crud):
@ -86,7 +83,6 @@ class TipoDocumentoCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_materia() permission_required = permissoes_materia()
list_field_names = ['descricao']
class TipoFimRelatoriaCrud(Crud): class TipoFimRelatoriaCrud(Crud):
@ -95,7 +91,6 @@ class TipoFimRelatoriaCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_materia() permission_required = permissoes_materia()
list_field_names = ['descricao']
class TipoAutorCrud(Crud): class TipoAutorCrud(Crud):
@ -104,7 +99,6 @@ class TipoAutorCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_materia() permission_required = permissoes_materia()
list_field_names = ['descricao']
class AutorCrud(Crud): class AutorCrud(Crud):
@ -113,7 +107,6 @@ class AutorCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_materia() permission_required = permissoes_materia()
list_field_names = ['username', 'tipo', 'nome']
class OrgaoCrud(Crud): class OrgaoCrud(Crud):
@ -122,8 +115,6 @@ class OrgaoCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_materia() permission_required = permissoes_materia()
list_field_names = ['nome', 'sigla', 'telefone',
'unidade_deliberativa']
class TipoProposicaoCrud(Crud): class TipoProposicaoCrud(Crud):
@ -132,8 +123,6 @@ class TipoProposicaoCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_materia() permission_required = permissoes_materia()
list_field_names = ['descricao', 'materia_ou_documento',
'tipo_materia', 'modelo']
class StatusTramitacaoCrud(Crud): class StatusTramitacaoCrud(Crud):
@ -142,7 +131,6 @@ class StatusTramitacaoCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_materia() permission_required = permissoes_materia()
list_field_names = ['sigla', 'descricao', 'indicador']
class UnidadeTramitacaoCrud(Crud): class UnidadeTramitacaoCrud(Crud):
@ -195,7 +183,7 @@ class ProposicaoCrud(Crud):
return [self._as_row(obj) for obj in object_list] return [self._as_row(obj) for obj in object_list]
class DeleteView(PermissionRequiredMixin, MasterDetailCrud.DeleteView): class DeleteView(PermissionRequiredMixin, CrudDeleteView):
permission_required = permissoes_materia() permission_required = permissoes_materia()
def delete(self, request, *args, **kwargs): def delete(self, request, *args, **kwargs):

53
sapl/parlamentares/views.py

@ -9,7 +9,7 @@ from django.utils.translation import ugettext_lazy as _
from django.views.generic import FormView from django.views.generic import FormView
from sapl.crud.base import (Crud, CrudCreateView, CrudListView, CrudUpdateView, from sapl.crud.base import (Crud, CrudCreateView, CrudListView, CrudUpdateView,
CrudBaseMixin) CrudBaseMixin, CrudDeleteView)
from sapl.crud.masterdetail import MasterDetailCrud from sapl.crud.masterdetail import MasterDetailCrud
from .forms import (ComposicaoColigacaoForm, FiliacaoForm, LegislaturaForm, from .forms import (ComposicaoColigacaoForm, FiliacaoForm, LegislaturaForm,
@ -37,7 +37,6 @@ class CargoMesaCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_parlamentares() permission_required = permissoes_parlamentares()
list_field_names = ['descricao', 'unico']
class PartidoCrud(Crud): class PartidoCrud(Crud):
@ -46,7 +45,6 @@ class PartidoCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_parlamentares() permission_required = permissoes_parlamentares()
list_field_names = ['nome', 'sigla', 'data_criacao', 'data_extincao']
class SessaoLegislativaCrud(Crud): class SessaoLegislativaCrud(Crud):
@ -55,9 +53,6 @@ class SessaoLegislativaCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_parlamentares() permission_required = permissoes_parlamentares()
list_field_names = ['numero', 'tipo', 'legislatura', 'data_inicio',
'data_fim', 'data_inicio_intervalo',
'data_fim_intervalo']
class TipoDependenteCrud(Crud): class TipoDependenteCrud(Crud):
@ -66,7 +61,6 @@ class TipoDependenteCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_parlamentares() permission_required = permissoes_parlamentares()
list_field_names = ['descricao']
class NivelInstrucaoCrud(Crud): class NivelInstrucaoCrud(Crud):
@ -75,7 +69,6 @@ class NivelInstrucaoCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_parlamentares() permission_required = permissoes_parlamentares()
list_field_names = ['descricao']
class TipoAfastamentoCrud(Crud): class TipoAfastamentoCrud(Crud):
@ -84,7 +77,6 @@ class TipoAfastamentoCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_parlamentares() permission_required = permissoes_parlamentares()
list_field_names = ['descricao', 'dispositivo', 'fim_mandato']
class TipoMilitarCrud(Crud): class TipoMilitarCrud(Crud):
@ -93,7 +85,6 @@ class TipoMilitarCrud(Crud):
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin): class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_parlamentares() permission_required = permissoes_parlamentares()
list_field_names = ['descricao']
class MandatoCrud(MasterDetailCrud): class MandatoCrud(MasterDetailCrud):
@ -104,6 +95,15 @@ class MandatoCrud(MasterDetailCrud):
class ListView(MasterDetailCrud.ListView): class ListView(MasterDetailCrud.ListView):
ordering = ('-legislatura__data_inicio') ordering = ('-legislatura__data_inicio')
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 ColigacaoCrud(Crud): class ColigacaoCrud(Crud):
model = Coligacao model = Coligacao
@ -112,6 +112,9 @@ class ColigacaoCrud(Crud):
class ListView(CrudListView): class ListView(CrudListView):
ordering = ('-legislatura__data_inicio', 'nome') ordering = ('-legislatura__data_inicio', 'nome')
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_parlamentares()
class ComposicaoColigacaoCrud(MasterDetailCrud): class ComposicaoColigacaoCrud(MasterDetailCrud):
model = ComposicaoColigacao model = ComposicaoColigacao
@ -135,6 +138,9 @@ class ComposicaoColigacaoCrud(MasterDetailCrud):
class ListView(MasterDetailCrud.ListView): class ListView(MasterDetailCrud.ListView):
ordering = '-partido__sigla' ordering = '-partido__sigla'
class BaseMixin(PermissionRequiredMixin, MasterDetailCrud.BaseMixin):
permission_required = permissoes_parlamentares()
class LegislaturaCrud(Crud): class LegislaturaCrud(Crud):
model = Legislatura model = Legislatura
@ -146,17 +152,25 @@ class LegislaturaCrud(Crud):
class UpdateView(CrudUpdateView): class UpdateView(CrudUpdateView):
form_class = LegislaturaForm form_class = LegislaturaForm
class BaseMixin(PermissionRequiredMixin, CrudBaseMixin):
permission_required = permissoes_parlamentares()
class FiliacaoCrud(MasterDetailCrud): class FiliacaoCrud(MasterDetailCrud):
model = Filiacao model = Filiacao
parent_field = 'parlamentar' parent_field = 'parlamentar'
help_path = '' help_path = ''
class CreateView(MasterDetailCrud.CreateView): class CreateView(PermissionRequiredMixin, MasterDetailCrud.CreateView):
form_class = FiliacaoForm form_class = FiliacaoForm
permission_required = permissoes_parlamentares()
class UpdateView(MasterDetailCrud.UpdateView): class UpdateView(PermissionRequiredMixin, MasterDetailCrud.UpdateView):
form_class = FiliacaoForm form_class = FiliacaoForm
permission_required = permissoes_parlamentares()
class DeleteView(PermissionRequiredMixin, MasterDetailCrud.DeleteView):
permission_required = permissoes_parlamentares()
class ListView(MasterDetailCrud.ListView): class ListView(MasterDetailCrud.ListView):
ordering = '-data' ordering = '-data'
@ -166,16 +180,22 @@ class ParlamentarCrud(Crud):
model = Parlamentar model = Parlamentar
help_path = '' help_path = ''
class UpdateView(CrudUpdateView): class UpdateView(PermissionRequiredMixin, CrudUpdateView):
form_class = ParlamentarForm form_class = ParlamentarForm
permission_required = permissoes_parlamentares()
class CreateView(CrudCreateView): class CreateView(PermissionRequiredMixin, CrudCreateView):
form_class = ParlamentarCreateForm form_class = ParlamentarCreateForm
permission_required = permissoes_parlamentares()
@property @property
def layout_key(self): def layout_key(self):
return 'ParlamentarCreate' return 'ParlamentarCreate'
class DeleteView(PermissionRequiredMixin, CrudDeleteView):
form_class = ParlamentarCreateForm
permission_required = permissoes_parlamentares()
class ListView(CrudListView): class ListView(CrudListView):
template_name = "parlamentares/parlamentares_list.html" template_name = "parlamentares/parlamentares_list.html"
paginate_by = None paginate_by = None
@ -230,11 +250,12 @@ class ParlamentarCrud(Crud):
return context return context
class MesaDiretoraView(FormView): class MesaDiretoraView(PermissionRequiredMixin, FormView):
template_name = "mesa_diretora/mesa_diretora.html" template_name = "mesa_diretora/mesa_diretora.html"
success_url = reverse_lazy('sapl.parlamentares:mesa_diretora') success_url = reverse_lazy('sapl.parlamentares:mesa_diretora')
permission_required = permissoes_parlamentares()
# Essa função avisa quando se pode compor uma Mesa Legislativa) # Essa função avisa quando se pode compor uma Mesa Legislativa
def validation(self, request): def validation(self, request):
mensagem = _("Não há nenhuma Sessão Legislativa cadastrada. \ mensagem = _("Não há nenhuma Sessão Legislativa cadastrada. \
é possível compor uma Mesa Diretora quando uma Sessão \ é possível compor uma Mesa Diretora quando uma Sessão \

Loading…
Cancel
Save