From 4a89630b04341d397edcb9b8a3743e75297a81c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rog=C3=A9rio=20Fr=C3=A1?= Date: Thu, 10 Aug 2017 11:26:10 -0300 Subject: [PATCH] Data obrigatoria em documentos acessorios (#1379) --- sapl/materia/forms.py | 1 + sapl/materia/tests/test_materia.py | 1 + sapl/materia/views.py | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index d56345179..5f5279d39 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -164,6 +164,7 @@ class AcompanhamentoMateriaForm(ModelForm): class DocumentoAcessorioForm(ModelForm): + data = forms.DateField(required=True) class Meta: model = DocumentoAcessorio diff --git a/sapl/materia/tests/test_materia.py b/sapl/materia/tests/test_materia.py index 5366959d2..0090376bf 100644 --- a/sapl/materia/tests/test_materia.py +++ b/sapl/materia/tests/test_materia.py @@ -226,6 +226,7 @@ def test_documento_acessorio_submit(admin_client): 'data_materia': '2016-03-21', 'autor': autor, 'ementa': 'teste_ementa', + 'data': '2016-03-21', 'salvar': 'salvar'}, follow=True) diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 58f9862f4..c4cf64639 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -1061,6 +1061,11 @@ class DocumentoAcessorioCrud(MasterDetailCrud): def __init__(self, **kwargs): super(MasterDetailCrud.CreateView, self).__init__(**kwargs) + + def get_initial(self): + self.initial['data'] = datetime.now().date() + + return self.initial def get_context_data(self, **kwargs): context = super(