Browse Source

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

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

52
sapl/sessao/views.py

@ -587,7 +587,7 @@ class ExpedienteMateriaCrud(MasterDetailCrud):
class OradorCrud(MasterDetailCrud):
model = ''
model = Orador
parent_field = 'sessao_plenaria'
help_topic = 'sessao_plenaria_oradores'
public = [RP_LIST, RP_DETAIL]
@ -596,6 +596,30 @@ class OradorCrud(MasterDetailCrud):
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):
model = OradorExpediente
@ -643,32 +667,6 @@ class OradorOrdemDiaCrud(OradorCrud):
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):
model = Bancada

Loading…
Cancel
Save