Browse Source

Fix Proposicao UpdateView

pull/527/head
Eduardo Edson Batista Cordeiro Alves 9 years ago
committed by Edward Ribeiro
parent
commit
2d9a8bb475
  1. 15
      sapl/materia/views.py

15
sapl/materia/views.py

@ -231,11 +231,16 @@ class ProposicaoCrud(Crud):
class UpdateView(CrudUpdateView):
form_class = ProposicaoForm
def get_initial(self):
self.initial['tipo_materia'] = self.object.materia.tipo.id
self.initial['numero_materia'] = self.object.materia.numero
self.initial['ano_materia'] = self.object.materia.ano
return self.initial
def get_context_data(self, **kwargs):
context = super(UpdateView, self).get_context_data(**kwargs)
if self.object.materia:
context['form'].fields['tipo_materia'].initial = (
self.object.materia.tipo.id)
context['form'].fields['numero_materia'].initial = (
self.object.materia.numero)
context['form'].fields['ano_materia'].initial = (
self.object.materia.ano)
return context
@property
def layout_key(self):

Loading…
Cancel
Save