diff --git a/materia/forms.py b/materia/forms.py index e8bc7389d..a1f6f9462 100644 --- a/materia/forms.py +++ b/materia/forms.py @@ -131,6 +131,10 @@ 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 10b0e382c..5b597ed38 100644 --- a/materia/views.py +++ b/materia/views.py @@ -166,7 +166,14 @@ 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 autor_row = crispy_layout_mixin.to_row( [('autor', 0), (Button('pesquisar', @@ -176,6 +183,7 @@ 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()) @@ -199,6 +207,13 @@ class DocumentoAcessorioCrud(MasterDetailCrud): 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