From ad2bdb4a7496045182366be4a7b5099475a0bd25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rog=C3=A9rio=20Fr=C3=A1?= Date: Tue, 10 Jan 2017 14:26:04 -0300 Subject: [PATCH] =?UTF-8?q?numero=20de=20normas=20alfa=20/=20anexo=20sess?= =?UTF-8?q?=C3=A3o=20(#879)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * numeraçao norma alfa * makemigrations numeraçao norma alga * Add files via upload * aceitar numero norma alfa * aceitar numero norma alfa * Adiciona anexo sessao * adiciona upload_anexo sessao_sessaoplenaria * Add files via upload * Add files via upload --- sapl/materia/tests/test_materia.py | 2 +- .../migrations/0029_auto_20161215_1652.py | 19 +++++++++++++++++ sapl/norma/migrations/0030_merge.py | 16 ++++++++++++++ .../migrations/0031_auto_20161219_1324.py | 20 ++++++++++++++++++ sapl/norma/models.py | 4 +++- sapl/norma/tests/test_norma.py | 2 +- .../migrations/0030_auto_20161215_1652.py | 20 ++++++++++++++++++ sapl/sessao/migrations/0031_merge.py | 16 ++++++++++++++ .../0032_sessaoplenaria_upload_anexo.py | 21 +++++++++++++++++++ sapl/sessao/models.py | 9 ++++++++ 10 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 sapl/norma/migrations/0029_auto_20161215_1652.py create mode 100644 sapl/norma/migrations/0030_merge.py create mode 100644 sapl/norma/migrations/0031_auto_20161219_1324.py create mode 100644 sapl/sessao/migrations/0030_auto_20161215_1652.py create mode 100644 sapl/sessao/migrations/0031_merge.py create mode 100644 sapl/sessao/migrations/0032_sessaoplenaria_upload_anexo.py diff --git a/sapl/materia/tests/test_materia.py b/sapl/materia/tests/test_materia.py index 4f88a8b79..20f3a12fa 100644 --- a/sapl/materia/tests/test_materia.py +++ b/sapl/materia/tests/test_materia.py @@ -55,7 +55,7 @@ def make_norma(): # Testa se a Norma foi criada norma = NormaJuridica.objects.first() assert norma.tipo == tipo - assert norma.numero == 1 + assert norma.numero == '1' assert norma.ano == 2016 return norma diff --git a/sapl/norma/migrations/0029_auto_20161215_1652.py b/sapl/norma/migrations/0029_auto_20161215_1652.py new file mode 100644 index 000000000..9ef00a353 --- /dev/null +++ b/sapl/norma/migrations/0029_auto_20161215_1652.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-12-15 16:52 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('norma', '0028_auto_20161202_1025'), + ] + + operations = [ + migrations.AlterModelOptions( + name='tiponormajuridica', + options={'ordering': ['descricao'], 'verbose_name': 'Tipo de Norma Jurídica', 'verbose_name_plural': 'Tipos de Norma Jurídica'}, + ), + ] diff --git a/sapl/norma/migrations/0030_merge.py b/sapl/norma/migrations/0030_merge.py new file mode 100644 index 000000000..beb05625c --- /dev/null +++ b/sapl/norma/migrations/0030_merge.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-12-19 13:06 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('norma', '0029_auto_20161216_1640'), + ('norma', '0029_auto_20161215_1652'), + ] + + operations = [ + ] diff --git a/sapl/norma/migrations/0031_auto_20161219_1324.py b/sapl/norma/migrations/0031_auto_20161219_1324.py new file mode 100644 index 000000000..27d77c035 --- /dev/null +++ b/sapl/norma/migrations/0031_auto_20161219_1324.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-12-19 13:24 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('norma', '0030_merge'), + ] + + operations = [ + migrations.AlterField( + model_name='normajuridica', + name='numero', + field=models.CharField(max_length=8, verbose_name='Número'), + ), + ] diff --git a/sapl/norma/models.py b/sapl/norma/models.py index 4d9780038..6abf975c4 100644 --- a/sapl/norma/models.py +++ b/sapl/norma/models.py @@ -71,7 +71,9 @@ class NormaJuridica(models.Model): TipoNormaJuridica, verbose_name=_('Tipo da Norma Juridica')) materia = models.ForeignKey( MateriaLegislativa, blank=True, null=True, verbose_name=_('Matéria')) - numero = models.PositiveIntegerField(verbose_name=_('Número')) + numero = models.CharField( + max_length=8, + verbose_name=_('Número')) ano = models.PositiveSmallIntegerField(verbose_name=_('Ano'), choices=RANGE_ANOS) esfera_federacao = models.CharField( diff --git a/sapl/norma/tests/test_norma.py b/sapl/norma/tests/test_norma.py index 65c0f28b1..6f12baa17 100644 --- a/sapl/norma/tests/test_norma.py +++ b/sapl/norma/tests/test_norma.py @@ -25,7 +25,7 @@ def test_incluir_norma_submit(admin_client): assert response.status_code == 200 norma = NormaJuridica.objects.first() - assert norma.numero == 1 + assert norma.numero == '1' assert norma.ano == 2016 assert norma.tipo == tipo diff --git a/sapl/sessao/migrations/0030_auto_20161215_1652.py b/sapl/sessao/migrations/0030_auto_20161215_1652.py new file mode 100644 index 000000000..a804fa820 --- /dev/null +++ b/sapl/sessao/migrations/0030_auto_20161215_1652.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-12-15 16:52 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sessao', '0029_auto_20161004_1101'), + ] + + operations = [ + migrations.AlterField( + model_name='bancada', + name='nome', + field=models.CharField(max_length=80, verbose_name='Nome da Bancada'), + ), + ] diff --git a/sapl/sessao/migrations/0031_merge.py b/sapl/sessao/migrations/0031_merge.py new file mode 100644 index 000000000..409f8be4d --- /dev/null +++ b/sapl/sessao/migrations/0031_merge.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-12-19 13:06 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('sessao', '0030_auto_20161216_1640'), + ('sessao', '0030_auto_20161215_1652'), + ] + + operations = [ + ] diff --git a/sapl/sessao/migrations/0032_sessaoplenaria_upload_anexo.py b/sapl/sessao/migrations/0032_sessaoplenaria_upload_anexo.py new file mode 100644 index 000000000..9a846f587 --- /dev/null +++ b/sapl/sessao/migrations/0032_sessaoplenaria_upload_anexo.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-12-28 09:53 +from __future__ import unicode_literals + +from django.db import migrations, models +import sapl.sessao.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sessao', '0031_merge'), + ] + + operations = [ + migrations.AddField( + model_name='sessaoplenaria', + name='upload_anexo', + field=models.FileField(blank=True, null=True, upload_to=sapl.sessao.models.anexo_upload_path, verbose_name='Anexo da Sessão'), + ), + ] diff --git a/sapl/sessao/models.py b/sapl/sessao/models.py index 2507b36ca..f5b6aab83 100644 --- a/sapl/sessao/models.py +++ b/sapl/sessao/models.py @@ -84,6 +84,10 @@ def ata_upload_path(instance, filename): return texto_upload_path(instance, filename, subpath='ata') # return get_sessao_media_path(instance, 'ata', filename) +def anexo_upload_path(instance, filename): + return texto_upload_path(instance, filename, subpath='anexo') + # return get_sessao_media_path(instance, 'anexo', filename) + class SessaoPlenaria(models.Model): # TODO trash??? Seems to have been a FK in the past. Would be: @@ -123,6 +127,11 @@ class SessaoPlenaria(models.Model): upload_to=ata_upload_path, verbose_name=_('Ata da Sessão'), validators=[restringe_tipos_de_arquivo_txt]) + upload_anexo = models.FileField( + blank=True, + null=True, + upload_to=anexo_upload_path, + verbose_name=_('Anexo da Sessão')) iniciada = models.NullBooleanField(blank=True, choices=YES_NO_CHOICES, verbose_name=_('Sessão iniciada?'))