diff --git a/sapl/sessao/forms.py b/sapl/sessao/forms.py index d069e5ce9..f0856330c 100644 --- a/sapl/sessao/forms.py +++ b/sapl/sessao/forms.py @@ -93,7 +93,7 @@ class ExpedienteMateriaForm(ModelForm): return self.cleaned_data['numero_ordem'] def clean_data_ordem(self): - return datetime.now() + return self.instance.sessao_plenaria.data_inicio def clean(self): cleaned_data = self.cleaned_data @@ -136,7 +136,7 @@ class OrdemDiaForm(ExpedienteMateriaForm): 'numero_materia', 'ano_materia', 'tipo_votacao'] def clean_data_ordem(self): - return datetime.now() + return self.instance.sessao_plenaria.data_inicio def clean(self): cleaned_data = self.cleaned_data diff --git a/sapl/sessao/views.py b/sapl/sessao/views.py index 99a992bba..3ccd0f4b0 100644 --- a/sapl/sessao/views.py +++ b/sapl/sessao/views.py @@ -133,6 +133,11 @@ class MateriaOrdemDiaCrud(MasterDetailCrud): class CreateView(MasterDetailCrud.CreateView): form_class = OrdemDiaForm + def get_initial(self): + self.initial['data_ordem'] = SessaoPlenaria.objects.get( + pk=self.kwargs['pk']).data_inicio.strftime('%d/%m/%Y') + return self.initial + def get_success_url(self): return reverse('sapl.sessao:ordemdia_list', kwargs={'pk': self.kwargs['pk']}) @@ -331,6 +336,11 @@ class ExpedienteMateriaCrud(MasterDetailCrud): class CreateView(MasterDetailCrud.CreateView): form_class = ExpedienteMateriaForm + def get_initial(self): + self.initial['data_ordem'] = SessaoPlenaria.objects.get( + pk=self.kwargs['pk']).data_inicio.strftime('%d/%m/%Y') + return self.initial + def get_success_url(self): return reverse('sapl.sessao:expedientemateria_list', kwargs={'pk': self.kwargs['pk']})