From c25ef9ffa8c436cd10451dcde74e2cab2a12d222 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Mon, 9 May 2016 10:37:21 -0300 Subject: [PATCH] =?UTF-8?q?Adicona=20busca=20de=20autor=20na=20cria=C3=A7?= =?UTF-8?q?=C3=A3o=20de=20documento=20acess=C3=B3rio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- materia/forms.py | 4 ---- materia/views.py | 24 +++++++++--------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/materia/forms.py b/materia/forms.py index a1f6f9462..e8bc7389d 100644 --- a/materia/forms.py +++ b/materia/forms.py @@ -131,10 +131,6 @@ class DocumentoAcessorioForm(ModelForm): if autor_field: return str(Autor.objects.get(id=autor_field)) - def __init__(self, *args, **kwargs): - super(DocumentoAcessorioForm, self).__init__(*args, **kwargs) - self.helper = FormHelper() - class RelatoriaForm(ModelForm): diff --git a/materia/views.py b/materia/views.py index 5b597ed38..80c5c0edd 100644 --- a/materia/views.py +++ b/materia/views.py @@ -166,14 +166,8 @@ class DocumentoAcessorioCrud(MasterDetailCrud): class CreateView(MasterDetailCrud.CreateView): form_class = DocumentoAcessorioForm -<<<<<<< c9d78fc1838416100fa92533705a9f4c2985190e def __init__(self, *args, **kwargs): -======= - def get_form(self, form_class=None): - form = super(CreateView, self).get_form(form_class) - form.helper.layout = self.get_layout() - ->>>>>>> Monta layout para autor + super(CreateView, self).__init__(*args, **kwargs) autor_row = crispy_layout_mixin.to_row( [('autor', 0), (Button('pesquisar', @@ -183,7 +177,6 @@ class DocumentoAcessorioCrud(MasterDetailCrud): 'Limpar Autor', css_class='btn btn-primary btn-sm'), 10)]) -<<<<<<< c9d78fc1838416100fa92533705a9f4c2985190e self.helper = FormHelper() self.helper.layout = crispy_layout_mixin.SaplFormLayout( *self.get_layout()) @@ -202,18 +195,19 @@ class DocumentoAcessorioCrud(MasterDetailCrud): ' class="btn btn-inverse">Cancelar')])) super(CreateView, self).__init__(*args, **kwargs) + self.helper = FormHelper() + self.helper.layout = Layout( + crispy_layout_mixin.to_row(self.get_layout()[0][1]), + HTML(sapl.utils.autor_label), + HTML(sapl.utils.autor_modal), + crispy_layout_mixin.to_row(self.get_layout()[0][2]), + crispy_layout_mixin.to_row(self.get_layout()[0][3]), + ) def get_context_data(self, **kwargs): context = super(CreateView, self).get_context_data(**kwargs) context['helper'] = self.helper return context -======= - form.helper.layout[0][2][0] = autor_row - form.helper.layout[0][1].append(HTML(sapl.utils.autor_label)) - form.helper.layout[0][1].append(HTML(sapl.utils.autor_modal)) - - return form ->>>>>>> Monta layout para autor class UpdateView(MasterDetailCrud.UpdateView): form_class = DocumentoAcessorioForm