Browse Source

Merge branch 'master' of github.com:interlegis/sapl

pull/713/head
Eduardo Calil 8 years ago
parent
commit
40092c7c24
  1. 3
      sapl/base/templatetags/menus.py
  2. 13
      sapl/sessao/forms.py
  3. 17
      sapl/sessao/views.py

3
sapl/base/templatetags/menus.py

@ -1,7 +1,6 @@
import yaml
from django import template from django import template
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
import yaml
register = template.Library() register = template.Library()

13
sapl/sessao/forms.py

@ -15,7 +15,8 @@ from sapl.parlamentares.models import Parlamentar
from sapl.utils import RANGE_DIAS_MES, RANGE_MESES, autor_label, autor_modal from sapl.utils import RANGE_DIAS_MES, RANGE_MESES, autor_label, autor_modal
from .models import (Bancada, ExpedienteMateria, Orador, OradorExpediente, from .models import (Bancada, ExpedienteMateria, Orador, OradorExpediente,
OrdemDia, SessaoPlenaria) OrdemDia, PresencaOrdemDia, SessaoPlenaria,
SessaoPlenariaPresenca)
def pega_anos(): def pega_anos():
@ -275,8 +276,15 @@ class OradorForm(ModelForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(OradorForm, self).__init__(*args, **kwargs) super(OradorForm, self).__init__(*args, **kwargs)
id_sessao = int(self.initial['id_sessao'])
ids = [s.parlamentar.id for
s in SessaoPlenariaPresenca.objects.filter(
sessao_plenaria_id=id_sessao)]
self.fields['parlamentar'].queryset = Parlamentar.objects.filter( self.fields['parlamentar'].queryset = Parlamentar.objects.filter(
ativo=True).order_by('nome_completo') id__in=ids).order_by('nome_completo')
class Meta: class Meta:
model = Orador model = Orador
@ -287,6 +295,7 @@ class OradorExpedienteForm(ModelForm):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(OradorExpedienteForm, self).__init__(*args, **kwargs) super(OradorExpedienteForm, self).__init__(*args, **kwargs)
self.fields['parlamentar'].queryset = Parlamentar.objects.filter( self.fields['parlamentar'].queryset = Parlamentar.objects.filter(
ativo=True).order_by('nome_completo') ativo=True).order_by('nome_completo')

17
sapl/sessao/views.py

@ -34,9 +34,10 @@ from sapl.sessao.serializers import SessaoPlenariaSerializer
from sapl.utils import permission_required_for_app from sapl.utils import permission_required_for_app
from .forms import (AdicionarVariasMateriasFilterSet, ExpedienteForm, from .forms import (AdicionarVariasMateriasFilterSet, ExpedienteForm,
ListMateriaForm, MesaForm, PautaSessaoFilterSet, ListMateriaForm, MesaForm, OradorExpedienteForm,
PresencaForm, SessaoPlenariaFilterSet, VotacaoEditForm, OradorForm, PautaSessaoFilterSet, PresencaForm,
VotacaoForm, VotacaoNominalForm) SessaoPlenariaFilterSet, VotacaoEditForm, VotacaoForm,
VotacaoNominalForm)
from .models import (Bancada, Bloco, CargoBancada, CargoMesa, from .models import (Bancada, Bloco, CargoBancada, CargoMesa,
ExpedienteMateria, ExpedienteSessao, IntegranteMesa, ExpedienteMateria, ExpedienteSessao, IntegranteMesa,
MateriaLegislativa, Orador, OradorExpediente, OrdemDia, MateriaLegislativa, Orador, OradorExpediente, OrdemDia,
@ -364,6 +365,11 @@ class OradorExpedienteCrud(OradorCrud):
class CreateView(MasterDetailCrud.CreateView): class CreateView(MasterDetailCrud.CreateView):
form_class = OradorExpedienteForm
def get_initial(self):
return {'id_sessao': self.kwargs['pk']}
def get_success_url(self): def get_success_url(self):
return reverse('sapl.sessao:oradorexpediente_list', return reverse('sapl.sessao:oradorexpediente_list',
kwargs={'pk': self.kwargs['pk']}) kwargs={'pk': self.kwargs['pk']})
@ -374,6 +380,11 @@ class OradorCrud(OradorCrud):
class CreateView(MasterDetailCrud.CreateView): class CreateView(MasterDetailCrud.CreateView):
form_class = OradorForm
def get_initial(self):
return {'id_sessao': self.kwargs['pk']}
def get_success_url(self): def get_success_url(self):
return reverse('sapl.sessao:orador_list', return reverse('sapl.sessao:orador_list',
kwargs={'pk': self.kwargs['pk']}) kwargs={'pk': self.kwargs['pk']})

Loading…
Cancel
Save