diff --git a/comissoes/views.py b/comissoes/views.py index 1c3b1254b..04515568c 100644 --- a/comissoes/views.py +++ b/comissoes/views.py @@ -1,3 +1,4 @@ +import sapl from crispy_forms.helper import FormHelper from crispy_forms.layout import ButtonHolder, Fieldset, Layout, Submit from django import forms @@ -5,10 +6,9 @@ from django.core.urlresolvers import reverse from django.forms import ModelForm from django.utils.translation import ugettext_lazy as _ from django.views.generic.edit import FormMixin -from vanilla import GenericView - from parlamentares.models import Filiacao, Parlamentar from sapl.crud import build_crud +from vanilla import GenericView from .models import (CargoComissao, Comissao, Composicao, Participacao, Periodo, TipoComissao) @@ -157,16 +157,26 @@ class ParticipacaoCadastroForm(ModelForm): def __init__(self, *args, **kwargs): self.helper = FormHelper() + + row1 = sapl.layout.to_row( + [('parlamentar_id', 4), + ('cargo', 4), + ('titular', 4)]) + + row2 = sapl.layout.to_row( + [('data_designacao', 6), + ('data_desligamento', 6)]) + + row3 = sapl.layout.to_row( + [('motivo_desligamento', 12)]) + + row4 = sapl.layout.to_row( + [('observacao', 12)]) + self.helper.layout = Layout( Fieldset( 'Formulário de Cadastro', - 'parlamentar_id', - 'cargo', - 'titular', - 'data_designacao', - 'data_desligamento', - 'motivo_desligamento', - 'observacao' + row1, row2, row3, row4 ), ButtonHolder( Submit('submit', 'Salvar', diff --git a/parlamentares/views.py b/parlamentares/views.py index 2fcba25e2..cdc57fed6 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -494,7 +494,7 @@ class ParlamentaresDependentesEditView(FormMixin, GenericView): return self.render_to_response( {'form': form, 'parlamentar': parlamentar, - ' legislatura_id': dependente.parlamentar.mandato_set.last( + 'legislatura_id': dependente.parlamentar.mandato_set.last( ).legislatura_id}) def post(self, request, *args, **kwargs):