From ee5db848d6cd25bb6e7f52539a6f9efd2a9270a2 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Tue, 24 Nov 2015 12:07:16 -0200 Subject: [PATCH] Refactor PreposicaoView layout --- materia/views.py | 66 ++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 38 deletions(-) diff --git a/materia/views.py b/materia/views.py index a51b29095..680c56622 100644 --- a/materia/views.py +++ b/materia/views.py @@ -1,8 +1,9 @@ from datetime import date -from comissoes.models import Comissao +import sapl +from comissoes.models import Comissao, Composicao from crispy_forms.helper import FormHelper -from crispy_forms.layout import HTML, ButtonHolder, Fieldset, Layout, Submit +from crispy_forms.layout import HTML, ButtonHolder, Fieldset, Layout, Submit, Column from django import forms from django.core.exceptions import ObjectDoesNotExist from django.core.urlresolvers import reverse @@ -11,7 +12,6 @@ from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from django.views.generic.edit import FormMixin from norma.models import LegislacaoCitada, NormaJuridica, TipoNormaJuridica -from comissoes.models import Composicao from sapl.crud import build_crud from vanilla import GenericView @@ -22,6 +22,7 @@ from .models import (Anexada, Autor, Autoria, DespachoInicial, TipoFimRelatoria, TipoMateriaLegislativa, TipoProposicao, Tramitacao, UnidadeTramitacao) + origem_crud = build_crud( Origem, 'origem', [ @@ -1726,44 +1727,33 @@ class ProposicaoForm(ModelForm): 'texto_original'] def __init__(self, *args, **kwargs): + + row1 = sapl.layout.to_row( + [('tipo', 12)]) + row2 = sapl.layout.to_row( + [('descricao', 12)]) + row3 = sapl.layout.to_row( + [('tipo_materia', 4), + ('numero_materia', 4), + ('ano_materia', 4)]) + row4 = sapl.layout.to_row( + [('texto_original', 10)]) + + row4.append( + Column( + ButtonHolder( + Submit('sumbmit', 'Salvar', + css_class='button primary') + ), css_class='columns large-2')) + self.helper = FormHelper() self.helper.layout = Layout( Fieldset('Incluir Proposição', - HTML( - ""), - HTML( - ""), - HTML( - ""), - HTML( - ""), - ButtonHolder( - Submit('submit', 'Salvar', - css_class='button primary') - ) - ), + row1, + row2, + row3, + row4, + ) ) super(ProposicaoForm, self).__init__( *args, **kwargs)