Browse Source

Monta layout para autor

pull/425/head
Eduardo Edson Batista Cordeiro Alves 9 years ago
parent
commit
86e127169f
  1. 4
      materia/forms.py
  2. 15
      materia/views.py

4
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):

15
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

Loading…
Cancel
Save