Browse Source

Adapta o 'form_actions' ao resto do código

pull/202/head
Eduardo Calil 9 years ago
parent
commit
fefef36e72
  1. 8
      parlamentares/views.py
  2. 2
      sapl/layout.py

8
parlamentares/views.py

@ -458,7 +458,7 @@ class ParlamentaresEditarView(FormMixin, GenericView):
form = ParlamentaresEditForm(request.POST, instance=parlamentar) form = ParlamentaresEditForm(request.POST, instance=parlamentar)
if form.is_valid(): if form.is_valid():
if 'save' in request.POST: if 'salvar' in request.POST:
parlamentar = form.save(commit=False) parlamentar = form.save(commit=False)
if 'fotografia' in request.FILES: if 'fotografia' in request.FILES:
parlamentar.fotografia = request.FILES['fotografia'] parlamentar.fotografia = request.FILES['fotografia']
@ -604,7 +604,7 @@ class ParlamentaresDependentesEditView(FormMixin, GenericView):
parlamentar = Parlamentar.objects.get(id=kwargs['pk']) parlamentar = Parlamentar.objects.get(id=kwargs['pk'])
if form.is_valid(): if form.is_valid():
if 'Salvar' in request.POST: if 'salvar' in request.POST:
dependente.save() dependente.save()
elif 'Excluir' in request.POST: elif 'Excluir' in request.POST:
dependente.delete() dependente.delete()
@ -991,7 +991,7 @@ class FiliacaoEditView(FormMixin, GenericView):
mensagem, mensagem,
request) request)
if 'Salvar' in request.POST: if 'salvar' in request.POST:
filiacao.save() filiacao.save()
elif 'Excluir' in request.POST: elif 'Excluir' in request.POST:
filiacao.delete() filiacao.delete()
@ -1122,7 +1122,7 @@ class MandatoEditView(FormMixin, GenericView):
parlamentar = Parlamentar.objects.get(id=kwargs['pk']) parlamentar = Parlamentar.objects.get(id=kwargs['pk'])
if form.is_valid(): if form.is_valid():
if 'Salvar' in request.POST: if 'salvar' in request.POST:
mandato.save() mandato.save()
elif 'Excluir' in request.POST: elif 'Excluir' in request.POST:
mandato.delete() mandato.delete()

2
sapl/layout.py

@ -23,7 +23,7 @@ def to_fieldsets(fields):
def form_actions(more=[], save_label=_('Salvar')): def form_actions(more=[], save_label=_('Salvar')):
return FormActions(Submit('save', save_label), *more) return FormActions(Submit('salvar', save_label), *more)
class SaplFormLayout(Layout): class SaplFormLayout(Layout):

Loading…
Cancel
Save