From 7b7483fe6513cc7306f11405b1c753904babf43e Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Fri, 6 Apr 2018 18:36:14 -0300 Subject: [PATCH 1/3] =?UTF-8?q?Ajusta=20normaliza=C3=A7=C3=A3o=20de=20nome?= =?UTF-8?q?s=20de=20arquivo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/utils.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/sapl/utils.py b/sapl/utils.py index 9d576bcea..873db5f17 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -534,24 +534,14 @@ def texto_upload_path(instance, filename, subpath='', pk_first=False): seguida para armazenar o arquivo. """ -# if subpath and '/' not in subpath: -# subpath = subpath + '/' - - """ TODO: Verifique possibilidade de otimização do código de normalização - do filename... - Não use slugify... arquivos, - geralmente, possuem [.][alguma extensão] - Slugify retira esse ponto... - """ - filename = re.sub('[^a-zA-Z0-9.]', '-', filename).strip('-').lower() - filename = re.sub('[-]+', '-', filename) - - prefix = 'public' + filename = re.sub('\s', '_', normalize(filename.strip()).lower()) from sapl.materia.models import Proposicao from sapl.protocoloadm.models import DocumentoAdministrativo if isinstance(instance, (DocumentoAdministrativo, Proposicao)): prefix = 'private' + else: + prefix = 'public' str_path = ('./sapl/%(prefix)s/%(model_name)s/' '%(subpath)s/%(pk)s/%(filename)s') From 9c47b8540f678dd1132e67892151b26539a0c59c Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Fri, 6 Apr 2018 19:46:30 -0300 Subject: [PATCH 2/3] Corrige texto_upload_path para subpath nulo --- sapl/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sapl/utils.py b/sapl/utils.py index 873db5f17..196e5b5cf 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -550,6 +550,9 @@ def texto_upload_path(instance, filename, subpath='', pk_first=False): str_path = ('./sapl/%(prefix)s/%(model_name)s/' '%(pk)s/%(subpath)s/%(filename)s') + if subpath is None: + subpath = '_' + path = str_path %\ { 'prefix': prefix, From 5d70c029f85c73b05283b69638661557712b1849 Mon Sep 17 00:00:00 2001 From: VictorFabreF Date: Mon, 9 Apr 2018 14:45:16 -0300 Subject: [PATCH 3/3] =?UTF-8?q?HOT-FIX:=20muda=20ordena=C3=A7=C3=A3o=20pro?= =?UTF-8?q?posi=C3=A7=C3=B5es=20incorporadas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0027_auto_20180409_1443.py | 19 +++++++++++++++++++ sapl/materia/models.py | 1 + sapl/materia/views.py | 2 +- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 sapl/materia/migrations/0027_auto_20180409_1443.py diff --git a/sapl/materia/migrations/0027_auto_20180409_1443.py b/sapl/materia/migrations/0027_auto_20180409_1443.py new file mode 100644 index 000000000..d93b64fdd --- /dev/null +++ b/sapl/materia/migrations/0027_auto_20180409_1443.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.13 on 2018-04-09 17:43 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('materia', '0026_auto_20180302_1411'), + ] + + operations = [ + migrations.AlterModelOptions( + name='proposicao', + options={'ordering': ['-data_recebimento'], 'permissions': (('detail_proposicao_enviada', 'Pode acessar detalhes de uma proposição enviada.'), ('detail_proposicao_devolvida', 'Pode acessar detalhes de uma proposição devolvida.'), ('detail_proposicao_incorporada', 'Pode acessar detalhes de uma proposição incorporada.')), 'verbose_name': 'Proposição', 'verbose_name_plural': 'Proposições'}, + ), + ] diff --git a/sapl/materia/models.py b/sapl/materia/models.py index e9b366fa9..ce4690c39 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -720,6 +720,7 @@ class Proposicao(models.Model): "\d\e d \d\e F \d\e Y")) class Meta: + ordering = ['-data_recebimento'] verbose_name = _('Proposição') verbose_name_plural = _('Proposições') unique_together = (('content_type', 'object_id'), ) diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 08a6a50ef..a23932b42 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -437,7 +437,7 @@ class ProposicaoPendente(PermissionRequiredMixin, ListView): class ProposicaoRecebida(PermissionRequiredMixin, ListView): template_name = 'materia/prop_recebidas_list.html' model = Proposicao - ordering = ['data_envio'] + paginate_by = 10 permission_required = 'materia.detail_proposicao_incorporada'