Browse Source

Retira duplicação da classe Orador (#2820)

pull/2824/head
Cesar Augusto de Carvalho 6 years ago
committed by Cesar Carvalho
parent
commit
d40952d8d6
  1. 52
      sapl/sessao/views.py

52
sapl/sessao/views.py

@ -587,7 +587,7 @@ class ExpedienteMateriaCrud(MasterDetailCrud):
class OradorCrud(MasterDetailCrud): class OradorCrud(MasterDetailCrud):
model = '' model = Orador
parent_field = 'sessao_plenaria' parent_field = 'sessao_plenaria'
help_topic = 'sessao_plenaria_oradores' help_topic = 'sessao_plenaria_oradores'
public = [RP_LIST, RP_DETAIL] public = [RP_LIST, RP_DETAIL]
@ -596,6 +596,30 @@ class OradorCrud(MasterDetailCrud):
ordering = ['numero_ordem', 'parlamentar'] ordering = ['numero_ordem', 'parlamentar']
class CreateView(MasterDetailCrud.CreateView):
form_class = OradorForm
def get_initial(self):
return {'id_sessao': self.kwargs['pk']}
def get_success_url(self):
return reverse('sapl.sessao:orador_list',
kwargs={'pk': self.kwargs['pk']})
class UpdateView(MasterDetailCrud.UpdateView):
form_class = OradorForm
def get_initial(self):
initial = super(UpdateView, self).get_initial()
initial.update({'id_sessao': self.object.sessao_plenaria.id})
initial.update({'numero':self.object.numero_ordem})
return initial
class OradorExpedienteCrud(OradorCrud): class OradorExpedienteCrud(OradorCrud):
model = OradorExpediente model = OradorExpediente
@ -643,32 +667,6 @@ class OradorOrdemDiaCrud(OradorCrud):
return initial return initial
class OradorCrud(OradorCrud):
model = Orador
class CreateView(MasterDetailCrud.CreateView):
form_class = OradorForm
def get_initial(self):
return {'id_sessao': self.kwargs['pk']}
def get_success_url(self):
return reverse('sapl.sessao:orador_list',
kwargs={'pk': self.kwargs['pk']})
class UpdateView(MasterDetailCrud.UpdateView):
form_class = OradorForm
def get_initial(self):
initial = super(UpdateView, self).get_initial()
initial.update({'id_sessao': self.object.sessao_plenaria.id})
initial.update({'numero':self.object.numero_ordem})
return initial
class BancadaCrud(CrudAux): class BancadaCrud(CrudAux):
model = Bancada model = Bancada

Loading…
Cancel
Save