From 32ee9220c98ac88945f52d74b2b31c88aee6a9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rog=C3=A9rio=20Fr=C3=A1?= Date: Mon, 22 May 2017 14:03:18 -0300 Subject: [PATCH] Fix 1104 (#1110) --- sapl/materia/forms.py | 12 ------------ sapl/materia/views.py | 4 ---- sapl/templates/materia/documentoacessorio_form.html | 2 +- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index 7c0b6d8c8..978fce522 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -164,18 +164,6 @@ class DocumentoAcessorioForm(ModelForm): class Meta: model = DocumentoAcessorio fields = ['tipo', 'nome', 'data', 'autor', 'ementa', 'arquivo'] - widgets = {'autor': forms.HiddenInput()} - - def clean_autor(self): - autor_field = self.cleaned_data['autor'] - try: - int(autor_field) - except ValueError: - return autor_field - else: - if autor_field: - return str(Autor.objects.get(id=autor_field)) - class RelatoriaForm(ModelForm): diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 4ff498cec..c3ad9f9e4 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -963,25 +963,21 @@ class DocumentoAcessorioCrud(MasterDetailCrud): form_class = DocumentoAcessorioForm def __init__(self, **kwargs): - montar_helper_documento_acessorio(self) super(MasterDetailCrud.CreateView, self).__init__(**kwargs) def get_context_data(self, **kwargs): context = super( MasterDetailCrud.CreateView, self).get_context_data(**kwargs) - context['helper'] = self.helper return context class UpdateView(MasterDetailCrud.UpdateView): form_class = DocumentoAcessorioForm def __init__(self, **kwargs): - montar_helper_documento_acessorio(self) super(MasterDetailCrud.UpdateView, self).__init__(**kwargs) def get_context_data(self, **kwargs): context = super(UpdateView, self).get_context_data(**kwargs) - context['helper'] = self.helper return context diff --git a/sapl/templates/materia/documentoacessorio_form.html b/sapl/templates/materia/documentoacessorio_form.html index fb5810653..e25d5d3ab 100644 --- a/sapl/templates/materia/documentoacessorio_form.html +++ b/sapl/templates/materia/documentoacessorio_form.html @@ -2,5 +2,5 @@ {% load i18n crispy_forms_tags %} {% block base_content %} - {% crispy form helper %} + {% crispy form %} {% endblock %}