Browse Source

Data obrigatoria em documentos acessorios (#1379)

pull/1383/head
Rogério Frá 7 years ago
committed by Edward
parent
commit
4a89630b04
  1. 1
      sapl/materia/forms.py
  2. 1
      sapl/materia/tests/test_materia.py
  3. 5
      sapl/materia/views.py

1
sapl/materia/forms.py

@ -164,6 +164,7 @@ class AcompanhamentoMateriaForm(ModelForm):
class DocumentoAcessorioForm(ModelForm): class DocumentoAcessorioForm(ModelForm):
data = forms.DateField(required=True)
class Meta: class Meta:
model = DocumentoAcessorio model = DocumentoAcessorio

1
sapl/materia/tests/test_materia.py

@ -226,6 +226,7 @@ def test_documento_acessorio_submit(admin_client):
'data_materia': '2016-03-21', 'data_materia': '2016-03-21',
'autor': autor, 'autor': autor,
'ementa': 'teste_ementa', 'ementa': 'teste_ementa',
'data': '2016-03-21',
'salvar': 'salvar'}, 'salvar': 'salvar'},
follow=True) follow=True)

5
sapl/materia/views.py

@ -1062,6 +1062,11 @@ class DocumentoAcessorioCrud(MasterDetailCrud):
def __init__(self, **kwargs): def __init__(self, **kwargs):
super(MasterDetailCrud.CreateView, self).__init__(**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): def get_context_data(self, **kwargs):
context = super( context = super(
MasterDetailCrud.CreateView, self).get_context_data(**kwargs) MasterDetailCrud.CreateView, self).get_context_data(**kwargs)

Loading…
Cancel
Save