From a67adbf0b4f24dc8d2b96d89c31797108181e1f6 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Mon, 7 Mar 2016 09:10:24 -0300 Subject: [PATCH] =?UTF-8?q?Ajusta=20campo=20de=20data=20obrigat=C3=B3rio?= =?UTF-8?q?=20e=20recupera=C3=A7=C3=A3o=20de=20dados=20na=20edi=C3=A7?= =?UTF-8?q?=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- materia/forms.py | 2 +- materia/views.py | 5 +---- templates/materia/numeracao_edit.html | 10 +++++----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/materia/forms.py b/materia/forms.py index 283516a68..5152974f3 100644 --- a/materia/forms.py +++ b/materia/forms.py @@ -385,7 +385,7 @@ class NumeracaoForm(ModelForm): ) data_materia = forms.DateField(label='Data', - required=False, + required=True, input_formats=['%d/%m/%Y'], widget=forms.TextInput( attrs={'class': 'dateinput'})) diff --git a/materia/views.py b/materia/views.py index 889da958c..24eed0b73 100644 --- a/materia/views.py +++ b/materia/views.py @@ -490,11 +490,8 @@ class NumeracaoView(FormMixin, GenericView): if form.is_valid(): numeracao = Numeracao() - tipo = TipoMateriaLegislativa.objects.get( - id=form.cleaned_data['tipo_materia']) - numeracao.materia = materia - numeracao.tipo_materia = tipo + numeracao.tipo_materia = form.cleaned_data['tipo_materia'] numeracao.numero_materia = form.cleaned_data['numero_materia'] numeracao.ano_materia = form.cleaned_data['ano_materia'] numeracao.data_materia = form.cleaned_data['data_materia'] diff --git a/templates/materia/numeracao_edit.html b/templates/materia/numeracao_edit.html index 6341e230a..692f4cfd3 100644 --- a/templates/materia/numeracao_edit.html +++ b/templates/materia/numeracao_edit.html @@ -16,7 +16,7 @@ label> - +
- +
- +
-