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): 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,73 +596,71 @@ class OradorCrud(MasterDetailCrud):
ordering = ['numero_ordem', 'parlamentar'] ordering = ['numero_ordem', 'parlamentar']
class OradorExpedienteCrud(OradorCrud):
model = OradorExpediente
class CreateView(MasterDetailCrud.CreateView): class CreateView(MasterDetailCrud.CreateView):
form_class = OradorExpedienteForm form_class = OradorForm
def get_initial(self): def get_initial(self):
return {'id_sessao': self.kwargs['pk']} 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:orador_list',
kwargs={'pk': self.kwargs['pk']}) kwargs={'pk': self.kwargs['pk']})
class UpdateView(MasterDetailCrud.UpdateView): class UpdateView(MasterDetailCrud.UpdateView):
form_class = OradorExpedienteForm
form_class = OradorForm
def get_initial(self): def get_initial(self):
return {'id_sessao': self.object.sessao_plenaria.id, initial = super(UpdateView, self).get_initial()
'numero': self.object.numero_ordem} initial.update({'id_sessao': self.object.sessao_plenaria.id})
initial.update({'numero':self.object.numero_ordem})
return initial
class OradorOrdemDiaCrud(OradorCrud):
model = OradorOrdemDia class OradorExpedienteCrud(OradorCrud):
model = OradorExpediente
class CreateView(MasterDetailCrud.CreateView): class CreateView(MasterDetailCrud.CreateView):
form_class = OradorOrdemDiaForm
form_class = OradorExpedienteForm
def get_initial(self): def get_initial(self):
return {'id_sessao': self.kwargs['pk']} return {'id_sessao': self.kwargs['pk']}
def get_success_url(self): def get_success_url(self):
return reverse('sapl.sessao:oradorordemdia_list', return reverse('sapl.sessao:oradorexpediente_list',
kwargs={'pk': self.kwargs['pk']}) kwargs={'pk': self.kwargs['pk']})
class UpdateView(MasterDetailCrud.UpdateView): class UpdateView(MasterDetailCrud.UpdateView):
form_class = OradorOrdemDiaForm form_class = OradorExpedienteForm
def get_initial(self): def get_initial(self):
initial = super(UpdateView, self).get_initial() return {'id_sessao': self.object.sessao_plenaria.id,
'numero': self.object.numero_ordem}
initial.update({'id_sessao': self.object.sessao_plenaria.id})
initial.update({'numero': self.object.numero_ordem})
return initial
class OradorCrud(OradorCrud): class OradorOrdemDiaCrud(OradorCrud):
model = Orador model = OradorOrdemDia
class CreateView(MasterDetailCrud.CreateView): class CreateView(MasterDetailCrud.CreateView):
form_class = OradorOrdemDiaForm
form_class = OradorForm
def get_initial(self): def get_initial(self):
return {'id_sessao': self.kwargs['pk']} 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:oradorordemdia_list',
kwargs={'pk': self.kwargs['pk']}) kwargs={'pk': self.kwargs['pk']})
class UpdateView(MasterDetailCrud.UpdateView): class UpdateView(MasterDetailCrud.UpdateView):
form_class = OradorOrdemDiaForm
form_class = OradorForm
def get_initial(self): def get_initial(self):
initial = super(UpdateView, self).get_initial() initial = super(UpdateView, self).get_initial()
initial.update({'id_sessao': self.object.sessao_plenaria.id}) initial.update({'id_sessao': self.object.sessao_plenaria.id})
initial.update({'numero': self.object.numero_ordem}) initial.update({'numero': self.object.numero_ordem})

Loading…
Cancel
Save