Browse Source

Coloca valor inicial na criacao de sessao plenaria

pull/675/head
Eduardo Calil 8 years ago
parent
commit
64cf6a3a08
  1. 10
      sapl/sessao/views.py

10
sapl/sessao/views.py

@ -25,7 +25,8 @@ from sapl.materia.models import (Autoria, DocumentoAcessorio,
TipoMateriaLegislativa, Tramitacao) TipoMateriaLegislativa, Tramitacao)
from sapl.materia.views import MateriaLegislativaPesquisaView from sapl.materia.views import MateriaLegislativaPesquisaView
from sapl.norma.models import NormaJuridica from sapl.norma.models import NormaJuridica
from sapl.parlamentares.models import Parlamentar from sapl.parlamentares.models import (Parlamentar, SessaoLegislativa,
Legislatura)
from sapl.sessao.serializers import SessaoPlenariaSerializer from sapl.sessao.serializers import SessaoPlenariaSerializer
from sapl.utils import permissao_tb_aux, permissoes_painel, permissoes_sessao from sapl.utils import permissao_tb_aux, permissoes_painel, permissoes_sessao
@ -485,6 +486,13 @@ class SessaoCrud(Crud):
class CreateView(PermissionRequiredMixin, CrudCreateView): class CreateView(PermissionRequiredMixin, CrudCreateView):
permission_required = permissoes_sessao() permission_required = permissoes_sessao()
def get_initial(self):
legislatura = Legislatura.objects.order_by('-numero')[0]
sessao_legislativa = SessaoLegislativa.objects.order_by(
'-data_inicio')[0]
return {'legislatura': legislatura,
'sessao_legislativa': sessao_legislativa}
class UpdateView(PermissionRequiredMixin, CrudUpdateView): class UpdateView(PermissionRequiredMixin, CrudUpdateView):
permission_required = permissoes_sessao() permission_required = permissoes_sessao()

Loading…
Cancel
Save