From 8ccb2237245fb8de2e088bf4e9e8a7abd660d83c Mon Sep 17 00:00:00 2001 From: Mariana Mendes Date: Thu, 23 Nov 2017 11:08:08 -0200 Subject: [PATCH] =?UTF-8?q?Adiciona=20a=20model,=20forms=20e=20views=20da?= =?UTF-8?q?=20reuni=C3=A3o=20de=20comiss=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/comissoes/forms.py | 19 +++++++------------ sapl/comissoes/models.py | 4 +--- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/sapl/comissoes/forms.py b/sapl/comissoes/forms.py index 33be2003d..53e93ef0a 100644 --- a/sapl/comissoes/forms.py +++ b/sapl/comissoes/forms.py @@ -9,6 +9,8 @@ from sapl.base.models import Autor, TipoAutor from sapl.comissoes.models import Comissao, Composicao, Participacao, Reuniao from sapl.parlamentares.models import Legislatura, Mandato, Parlamentar +from .models import Reuniao + class ParticipacaoCreateForm(forms.ModelForm): @@ -154,20 +156,13 @@ class ReuniaoForm(ModelForm): class Meta: model = Reuniao exclude = ['cod_andamento_reuniao'] - widgets = { - 'hora_fim': forms.TimeInput(format='%H:%M'), - 'hora_inicio': forms.TimeInput(format='%H:%M'), - } def clean(self): super(ReuniaoForm, self).clean() - if self.errors: - return - - if self.cleaned_data['hora_fim'] < self.cleaned_data['hora_inicio']: - msg = _('A hora de término da reunião não pode ' - 'ser menor que a de início') - raise ValidationError(msg) - + if self.cleaned_data['hora_fim']: + if (self.cleaned_data['hora_fim'] < + self.cleaned_data['hora_inicio']): + msg = _('A hora de término da reunião não pode ser menor que a de início') + raise ValidationError(msg) return self.cleaned_data diff --git a/sapl/comissoes/models.py b/sapl/comissoes/models.py index 882fe8638..f54588aac 100644 --- a/sapl/comissoes/models.py +++ b/sapl/comissoes/models.py @@ -182,15 +182,13 @@ class Participacao(models.Model): # ComposicaoComissao def get_comissao_media_path(instance, subpath, filename): return './sapl/comissao/%s/%s/%s' % (instance.numero, subpath, filename) - def pauta_upload_path(instance, filename): - return texto_upload_path(instance, filename, subpath='pauta', pk_first=True) + return texto_upload_path(instance, filename, subpath='pauta', pk_first=True) def ata_upload_path(instance, filename): return texto_upload_path(instance, filename, subpath='ata', pk_first=True) - def anexo_upload_path(instance, filename): return texto_upload_path(instance, filename, subpath='anexo', pk_first=True)