Browse Source

Fix #608

pull/626/head
Eduardo Edson Batista Cordeiro Alves 8 years ago
parent
commit
5bbf1c29bf
  1. 28
      sapl/sessao/forms.py
  2. 10
      sapl/sessao/views.py

28
sapl/sessao/forms.py

@ -11,9 +11,11 @@ from django.utils.translation import ugettext_lazy as _
from sapl.crispy_layout_mixin import form_actions, to_row
from sapl.materia.forms import MateriaLegislativaFilterSet
from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa
from sapl.parlamentares.models import Parlamentar
from sapl.utils import RANGE_DIAS_MES, RANGE_MESES, autor_label, autor_modal
from .models import Bancada, ExpedienteMateria, OrdemDia, SessaoPlenaria
from .models import (Bancada, ExpedienteMateria, Orador, OradorExpediente,
OrdemDia, SessaoPlenaria)
def pega_anos():
@ -265,3 +267,27 @@ class AdicionarVariasMateriasFilterSet(MateriaLegislativaFilterSet):
row4, row5, row6, row7, row8,
form_actions(save_label='Pesquisar'))
)
class OradorForm(ModelForm):
def __init__(self, *args, **kwargs):
super(OradorForm, self).__init__(*args, **kwargs)
self.fields['parlamentar'].queryset = Parlamentar.objects.filter(
ativo=True).order_by('nome_completo')
class Meta:
model = Orador
exclude = ['sessao_plenaria']
class OradorExpedienteForm(ModelForm):
def __init__(self, *args, **kwargs):
super(OradorExpedienteForm, self).__init__(*args, **kwargs)
self.fields['parlamentar'].queryset = Parlamentar.objects.filter(
ativo=True).order_by('nome_completo')
class Meta:
model = OradorExpediente
exclude = ['sessao_plenaria']

10
sapl/sessao/views.py

@ -29,9 +29,9 @@ from sapl.utils import permissao_tb_aux, permissoes_painel, permissoes_sessao
from .forms import (AdicionarVariasMateriasFilterSet, BancadaForm,
ExpedienteForm, ExpedienteMateriaForm, ListMateriaForm,
MesaForm, OrdemDiaForm, PresencaForm,
SessaoPlenariaFilterSet, VotacaoEditForm, VotacaoForm,
VotacaoNominalForm)
MesaForm, OradorExpedienteForm, OradorForm, OrdemDiaForm,
PresencaForm, SessaoPlenariaFilterSet, VotacaoEditForm,
VotacaoForm, VotacaoNominalForm)
from .models import (Bancada, Bloco, CargoBancada, CargoMesa,
ExpedienteMateria, ExpedienteSessao, IntegranteMesa,
MateriaLegislativa, Orador, OradorExpediente, OrdemDia,
@ -400,6 +400,7 @@ class OradorExpedienteCrud(OradorCrud):
class CreateView(PermissionRequiredMixin, MasterDetailCrud.CreateView):
permission_required = permissoes_sessao()
form_class = OradorExpedienteForm
def get_success_url(self):
return reverse('sapl.sessao:oradorexpediente_list',
@ -407,6 +408,7 @@ class OradorExpedienteCrud(OradorCrud):
class UpdateView(PermissionRequiredMixin, MasterDetailCrud.UpdateView):
permission_required = permissoes_sessao()
form_class = OradorExpedienteForm
class DeleteView(PermissionRequiredMixin, MasterDetailCrud.DeleteView):
permission_required = permissoes_sessao()
@ -417,6 +419,7 @@ class OradorCrud(OradorCrud):
class CreateView(PermissionRequiredMixin, MasterDetailCrud.CreateView):
permission_required = permissoes_sessao()
form_class = OradorForm
def get_success_url(self):
return reverse('sapl.sessao:orador_list',
@ -424,6 +427,7 @@ class OradorCrud(OradorCrud):
class UpdateView(PermissionRequiredMixin, MasterDetailCrud.UpdateView):
permission_required = permissoes_sessao()
form_class = OradorForm
class DeleteView(PermissionRequiredMixin, MasterDetailCrud.DeleteView):
permission_required = permissoes_sessao()

Loading…
Cancel
Save