From bcc7344876db7e6e8fdfcec5ced13bf46ca2ecf2 Mon Sep 17 00:00:00 2001 From: LeandroRoberto Date: Fri, 9 Mar 2018 10:31:32 -0300 Subject: [PATCH] Revert "Fix #1566 (#1739)" This reverts commit e7c1aa587929115a96f174d78ae3fe2b7ef99532. --- sapl/comissoes/forms.py | 18 ++++++++---- sapl/comissoes/legacy.yaml | 1 + .../migrations/0010_auto_20180307_1645.py | 29 ------------------- sapl/comissoes/migrations/0011_merge.py | 16 ---------- sapl/comissoes/models.py | 12 ++++++-- sapl/materia/forms.py | 1 - sapl/templates/comissoes/layouts.yaml | 5 ++-- sapl/templates/comissoes/subnav.yaml | 1 - 8 files changed, 25 insertions(+), 58 deletions(-) delete mode 100644 sapl/comissoes/migrations/0010_auto_20180307_1645.py delete mode 100644 sapl/comissoes/migrations/0011_merge.py diff --git a/sapl/comissoes/forms.py b/sapl/comissoes/forms.py index a3414e755..33be2003d 100644 --- a/sapl/comissoes/forms.py +++ b/sapl/comissoes/forms.py @@ -10,7 +10,6 @@ from sapl.comissoes.models import Comissao, Composicao, Participacao, Reuniao from sapl.parlamentares.models import Legislatura, Mandato, Parlamentar - class ParticipacaoCreateForm(forms.ModelForm): parent_pk = forms.CharField(required=False) # widget=forms.HiddenInput()) @@ -155,13 +154,20 @@ 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.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) + 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) + return self.cleaned_data diff --git a/sapl/comissoes/legacy.yaml b/sapl/comissoes/legacy.yaml index 59aacf503..2414df885 100644 --- a/sapl/comissoes/legacy.yaml +++ b/sapl/comissoes/legacy.yaml @@ -47,6 +47,7 @@ Participacao (ComposicaoComissao): Reuniao: periodo: periodo_reuniao comissao: cod_comissao + tipo: tipo_comissao numero: num_comissao nome: nom_reuniao tema: tem_reuniao diff --git a/sapl/comissoes/migrations/0010_auto_20180307_1645.py b/sapl/comissoes/migrations/0010_auto_20180307_1645.py deleted file mode 100644 index 45b86bec4..000000000 --- a/sapl/comissoes/migrations/0010_auto_20180307_1645.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.13 on 2018-03-07 19:45 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('comissoes', '0009_auto_20180301_1011'), - ] - - operations = [ - migrations.RemoveField( - model_name='reuniao', - name='tipo', - ), - migrations.AlterField( - model_name='reuniao', - name='nome', - field=models.CharField(max_length=150, verbose_name='Nome da Reunião'), - ), - migrations.AlterField( - model_name='reuniao', - name='tema', - field=models.CharField(blank=True, max_length=150, verbose_name='Tema da Reunião'), - ), - ] diff --git a/sapl/comissoes/migrations/0011_merge.py b/sapl/comissoes/migrations/0011_merge.py deleted file mode 100644 index a5a3c7b7a..000000000 --- a/sapl/comissoes/migrations/0011_merge.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.13 on 2018-03-09 10:27 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('comissoes', '0010_auto_20180307_1645'), - ('comissoes', '0010_auto_20180306_0918'), - ] - - operations = [ - ] diff --git a/sapl/comissoes/models.py b/sapl/comissoes/models.py index ed3cd3e50..882fe8638 100644 --- a/sapl/comissoes/models.py +++ b/sapl/comissoes/models.py @@ -182,13 +182,15 @@ 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): +def pauta_upload_path(instance, filename): 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) @@ -202,11 +204,15 @@ class Reuniao(models.Model): Comissao, on_delete=models.PROTECT, verbose_name=_('Comissão')) + tipo = models.ForeignKey( + TipoComissao, + on_delete=models.PROTECT, + verbose_name=_('Tipo de Comissão')) numero = models.PositiveIntegerField(verbose_name=_('Número')) nome = models.CharField( - max_length=150, verbose_name=_('Nome da Reunião')) + max_length=100, verbose_name=_('Nome da Reunião')) tema = models.CharField( - max_length=150, blank=True, verbose_name=_('Tema da Reunião')) + max_length=100, verbose_name=_('Tema da Reunião')) data = models.DateField(verbose_name=_('Data')) hora_inicio = models.TimeField( verbose_name=_('Horário de Início (hh:mm)')) diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index b6d74e970..1eebd5c7d 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -1265,7 +1265,6 @@ class ProposicaoForm(forms.ModelForm): inst.texto_original.delete() self.gerar_hash(inst, receber_recibo) - return super().save(commit) inst.ano = timezone.now().year diff --git a/sapl/templates/comissoes/layouts.yaml b/sapl/templates/comissoes/layouts.yaml index 5d0026ba2..231477a9c 100644 --- a/sapl/templates/comissoes/layouts.yaml +++ b/sapl/templates/comissoes/layouts.yaml @@ -46,10 +46,11 @@ ParticipacaoEdit: Reuniao: {% trans 'Reunião' %}: - - periodo numero + - periodo numero tipo - nome tema local_reuniao - data hora_inicio hora_fim - url_video url_audio - observacao - upload_pauta upload_ata upload_anexo - - comissao \ No newline at end of file + - comissao + diff --git a/sapl/templates/comissoes/subnav.yaml b/sapl/templates/comissoes/subnav.yaml index e7e49837b..01c10b4f3 100644 --- a/sapl/templates/comissoes/subnav.yaml +++ b/sapl/templates/comissoes/subnav.yaml @@ -8,4 +8,3 @@ url: materias_em_tramitacao - title: {% trans 'Reunião' %} url: reuniao_list -