Browse Source

Fix #3022 - Limite de Nome de Arquivo (#3025)

pull/3042/head
João Rodrigues 5 years ago
committed by Edward Ribeiro
parent
commit
842ea39185
  1. 31
      sapl/audiencia/forms.py
  2. 32
      sapl/audiencia/migrations/0013_auto_20191023_1522.py
  3. 21
      sapl/audiencia/migrations/0014_auto_20191023_1538.py
  4. 8
      sapl/audiencia/models.py
  5. 40
      sapl/comissoes/forms.py
  6. 20
      sapl/comissoes/migrations/0022_auto_20191118_2036.py
  7. 42
      sapl/comissoes/migrations/0022_auto_20191120_1440.py
  8. 8
      sapl/comissoes/models.py
  9. 26
      sapl/materia/forms.py
  10. 20
      sapl/materia/migrations/0061_auto_20191118_2036.py
  11. 37
      sapl/materia/migrations/0061_auto_20191120_1440.py
  12. 6
      sapl/materia/models.py
  13. 38
      sapl/norma/forms.py
  14. 22
      sapl/norma/migrations/0028_auto_20191024_1330.py
  15. 22
      sapl/norma/migrations/0029_auto_20191024_1344.py
  16. 4
      sapl/norma/models.py
  17. 46
      sapl/protocoloadm/forms.py
  18. 20
      sapl/protocoloadm/migrations/0026_auto_20191118_2036.py
  19. 31
      sapl/protocoloadm/migrations/0026_auto_20191120_1440.py
  20. 4
      sapl/protocoloadm/models.py
  21. 74
      sapl/sessao/forms.py
  22. 32
      sapl/sessao/migrations/0048_auto_20191029_1418.py
  23. 32
      sapl/sessao/migrations/0049_auto_20191029_1434.py
  24. 22
      sapl/sessao/migrations/0050_auto_20191029_1441.py
  25. 10
      sapl/sessao/models.py
  26. 49
      sapl/utils.py

31
sapl/audiencia/forms.py

@ -1,17 +1,16 @@
import logging
from django import forms
from sapl.settings import MAX_DOC_UPLOAD_SIZE
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import transaction
from django.utils.translation import ugettext_lazy as _
from sapl.audiencia.models import AudienciaPublica, TipoAudienciaPublica, AnexoAudienciaPublica
from crispy_forms.layout import HTML, Button, Column, Fieldset, Layout
from sapl.crispy_layout_mixin import SaplFormHelper
from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row
from crispy_forms.layout import Button, Column, Fieldset, HTML, Layout
from sapl.audiencia.models import AudienciaPublica, TipoAudienciaPublica, AnexoAudienciaPublica
from sapl.crispy_layout_mixin import form_actions, SaplFormHelper, SaplFormLayout, to_row
from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa
from sapl.utils import timezone, FileFieldCheckMixin
from sapl.utils import timezone, FileFieldCheckMixin, validar_arquivo
class AudienciaForm(FileFieldCheckMixin, forms.ModelForm):
logger = logging.getLogger(__name__)
@ -119,17 +118,14 @@ class AudienciaForm(FileFieldCheckMixin, forms.ModelForm):
upload_ata = self.cleaned_data.get('upload_ata', False)
upload_anexo = self.cleaned_data.get('upload_anexo', False)
if upload_pauta and upload_pauta.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Pauta da Audiência Pública deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (upload_pauta.size/1024)/1024))
if upload_pauta:
validar_arquivo(upload_pauta, "Pauta da Audiência Pública")
if upload_ata and upload_ata.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Ata da Audiência Pública deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (upload_ata.size/1024)/1024))
if upload_ata:
validar_arquivo(upload_ata, "Ata da Audiência Pública")
if upload_anexo and upload_anexo.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Anexo da Audiência Pública deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (upload_anexo.size/1024)/1024))
if upload_anexo:
validar_arquivo(upload_anexo, "Anexo da Audiência Pública")
return cleaned_data
@ -164,8 +160,7 @@ class AnexoAudienciaPublicaForm(forms.ModelForm):
arquivo = self.cleaned_data.get('arquivo', False)
if arquivo and arquivo.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (arquivo.size/1024)/1024))
if arquivo:
validar_arquivo(arquivo, "Arquivo")
return self.cleaned_data

32
sapl/audiencia/migrations/0013_auto_20191023_1522.py

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-10-23 18:22
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.audiencia.models
import sapl.utils
class Migration(migrations.Migration):
dependencies = [
('audiencia', '0012_auto_20191001_1115'),
]
operations = [
migrations.AlterField(
model_name='audienciapublica',
name='upload_anexo',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.audiencia.models.anexo_upload_path, verbose_name='Anexo da Audiência Pública'),
),
migrations.AlterField(
model_name='audienciapublica',
name='upload_ata',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.audiencia.models.ata_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Ata da Audiência Pública'),
),
migrations.AlterField(
model_name='audienciapublica',
name='upload_pauta',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.audiencia.models.pauta_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Pauta da Audiência Pública'),
),
]

21
sapl/audiencia/migrations/0014_auto_20191023_1538.py

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-10-23 18:38
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.utils
class Migration(migrations.Migration):
dependencies = [
('audiencia', '0013_auto_20191023_1522'),
]
operations = [
migrations.AlterField(
model_name='anexoaudienciapublica',
name='arquivo',
field=models.FileField(max_length=300, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.utils.texto_upload_path, verbose_name='Arquivo'),
),
]

8
sapl/audiencia/models.py

@ -87,7 +87,7 @@ class AudienciaPublica(models.Model):
max_length=150, blank=True,
verbose_name=_('URL Arquivo Vídeo (Formatos MP4 / FLV / WebM)'))
upload_pauta = models.FileField(
max_length=200,
max_length=300,
blank=True,
null=True,
upload_to=pauta_upload_path,
@ -95,7 +95,7 @@ class AudienciaPublica(models.Model):
verbose_name=_('Pauta da Audiência Pública'),
validators=[restringe_tipos_de_arquivo_txt])
upload_ata = models.FileField(
max_length=200,
max_length=300,
blank=True,
null=True,
upload_to=ata_upload_path,
@ -103,7 +103,7 @@ class AudienciaPublica(models.Model):
storage=OverwriteStorage(),
validators=[restringe_tipos_de_arquivo_txt])
upload_anexo = models.FileField(
max_length=200,
max_length=300,
blank=True,
null=True,
upload_to=anexo_upload_path,
@ -167,7 +167,7 @@ class AnexoAudienciaPublica(models.Model):
audiencia = models.ForeignKey(AudienciaPublica,
on_delete=models.PROTECT)
arquivo = models.FileField(
max_length=200,
max_length=300,
upload_to=texto_upload_path,
storage=OverwriteStorage(),
verbose_name=_('Arquivo'))

40
sapl/comissoes/forms.py

@ -12,13 +12,16 @@ from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _
from sapl.base.models import Autor, TipoAutor
from sapl.comissoes.models import (Comissao, Composicao, DocumentoAcessorio,
Participacao, Periodo, Reuniao)
from sapl.crispy_layout_mixin import form_actions, SaplFormHelper, to_row
from sapl.comissoes.models import (Comissao, Composicao,
DocumentoAcessorio, Participacao,
Periodo, Reuniao)
from sapl.crispy_layout_mixin import (form_actions, SaplFormHelper,
to_row)
from sapl.materia.models import MateriaEmTramitacao, PautaReuniao
from sapl.parlamentares.models import Legislatura, Mandato, Parlamentar
from sapl.settings import MAX_DOC_UPLOAD_SIZE
from sapl.utils import FileFieldCheckMixin, FilterOverridesMetaMixin
from sapl.parlamentares.models import (Legislatura, Mandato,
Parlamentar)
from sapl.utils import (FileFieldCheckMixin, FilterOverridesMetaMixin,
validar_arquivo)
class ComposicaoForm(forms.ModelForm):
@ -405,17 +408,14 @@ class ReuniaoForm(ModelForm):
upload_ata = self.cleaned_data.get('upload_ata', False)
upload_anexo = self.cleaned_data.get('upload_anexo', False)
if upload_pauta and upload_pauta.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Pauta da Reunião deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (upload_pauta.size/1024)/1024))
if upload_pauta:
validar_arquivo(upload_pauta, "Pauta da Reunião")
if upload_ata and upload_ata.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Ata da Reunião deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (upload_ata.size/1024)/1024))
if upload_ata:
validar_arquivo(upload_ata, "Ata da Reunião")
if upload_anexo and upload_anexo.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Anexo da Reunião deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (upload_anexo.size/1024)/1024))
if upload_anexo:
validar_arquivo(upload_anexo, "Anexo da Reunião")
return self.cleaned_data
@ -482,9 +482,8 @@ class DocumentoAcessorioCreateForm(FileFieldCheckMixin, forms.ModelForm):
arquivo = self.cleaned_data.get('arquivo', False)
if arquivo and arquivo.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Texto Integral deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (arquivo.size/1024)/1024))
if arquivo:
validar_arquivo(arquivo, "Texto Integral")
return self.cleaned_data
@ -509,8 +508,7 @@ class DocumentoAcessorioEditForm(FileFieldCheckMixin, forms.ModelForm):
arquivo = self.cleaned_data.get('arquivo', False)
if arquivo and arquivo.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Texto Integral deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (arquivo.size/1024)/1024))
if arquivo:
validar_arquivo(arquivo, "Texto Integral")
return self.cleaned_data

20
sapl/comissoes/migrations/0022_auto_20191118_2036.py

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-11-18 23:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comissoes', '0021_auto_20191001_1115'),
]
operations = [
migrations.AlterField(
model_name='documentoacessorio',
name='autor',
field=models.CharField(max_length=200, verbose_name='Autor'),
),
]

42
sapl/comissoes/migrations/0022_auto_20191120_1440.py

@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-11-20 17:40
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.comissoes.models
import sapl.utils
class Migration(migrations.Migration):
dependencies = [
('comissoes', '0021_auto_20191001_1115'),
]
operations = [
migrations.AlterField(
model_name='documentoacessorio',
name='arquivo',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.comissoes.models.anexo_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Integral'),
),
migrations.AlterField(
model_name='documentoacessorio',
name='autor',
field=models.CharField(max_length=200, verbose_name='Autor'),
),
migrations.AlterField(
model_name='reuniao',
name='upload_anexo',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.comissoes.models.anexo_upload_path, verbose_name='Anexo da Reunião'),
),
migrations.AlterField(
model_name='reuniao',
name='upload_ata',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.comissoes.models.ata_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Ata da Reunião'),
),
migrations.AlterField(
model_name='reuniao',
name='upload_pauta',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.comissoes.models.pauta_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Pauta da Reunião'),
),
]

8
sapl/comissoes/models.py

@ -236,21 +236,21 @@ class Reuniao(models.Model):
max_length=150, blank=True,
verbose_name=_('URL do Arquivo de Vídeo (Formatos MP4 / FLV / WebM)'))
upload_pauta = models.FileField(
max_length=200,
max_length=300,
blank=True, null=True,
upload_to=pauta_upload_path,
verbose_name=_('Pauta da Reunião'),
storage=OverwriteStorage(),
validators=[restringe_tipos_de_arquivo_txt])
upload_ata = models.FileField(
max_length=200,
max_length=300,
blank=True, null=True,
upload_to=ata_upload_path,
verbose_name=_('Ata da Reunião'),
storage=OverwriteStorage(),
validators=[restringe_tipos_de_arquivo_txt])
upload_anexo = models.FileField(
max_length=200,
max_length=300,
blank=True, null=True,
upload_to=anexo_upload_path,
storage=OverwriteStorage(),
@ -321,7 +321,7 @@ class DocumentoAcessorio(models.Model):
ementa = models.TextField(blank=True, verbose_name=_('Ementa'))
indexacao = models.TextField(blank=True)
arquivo = models.FileField(
max_length=200,
max_length=300,
blank=True,
null=True,
upload_to=anexo_upload_path,

26
sapl/materia/forms.py

@ -4,8 +4,8 @@ import os
import sapl
from crispy_forms.bootstrap import Alert, InlineRadios
from crispy_forms.layout import (HTML, Button, Field, Fieldset,
Layout, Row)
from crispy_forms.layout import (Button, Field, Fieldset, HTML, Layout, Row)
from django import forms
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist, ValidationError
@ -28,8 +28,8 @@ from sapl.base.signals import post_save_signal
from sapl.comissoes.models import Comissao, Composicao, Participacao
from sapl.compilacao.models import (STATUS_TA_IMMUTABLE_PUBLIC,
STATUS_TA_PRIVATE)
from sapl.crispy_layout_mixin import (SaplFormLayout, form_actions,
to_column, to_row, SaplFormHelper)
from sapl.crispy_layout_mixin import (form_actions, SaplFormHelper,
SaplFormLayout, to_column, to_row)
from sapl.materia.models import (AssuntoMateria, Autoria, MateriaAssunto,
MateriaLegislativa, Orgao,
RegimeTramitacao, StatusTramitacao,
@ -40,7 +40,6 @@ from sapl.norma.models import (LegislacaoCitada, NormaJuridica,
from sapl.parlamentares.models import Legislatura, Partido, Parlamentar
from sapl.protocoloadm.models import (Anexado, DocumentoAdministrativo,
Protocolo)
from sapl.settings import MAX_DOC_UPLOAD_SIZE
from sapl.utils import (autor_label, autor_modal,
ChoiceWithoutValidationField,
choice_anos_com_materias, FileFieldCheckMixin,
@ -48,7 +47,7 @@ from sapl.utils import (autor_label, autor_modal,
lista_anexados, MateriaPesquisaOrderingFilter,
models_with_gr_for_model, qs_override_django_filter,
RangeWidgetOverride, SEPARADOR_HASH_PROPOSICAO,
YES_NO_CHOICES)
validar_arquivo, YES_NO_CHOICES)
from .models import (AcompanhamentoMateria, Anexada, Autoria,
DespachoInicial, DocumentoAcessorio, Numeracao,
@ -254,9 +253,8 @@ class MateriaLegislativaForm(FileFieldCheckMixin, ModelForm):
texto_original = self.cleaned_data.get('texto_original', False)
if texto_original and texto_original.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Texto Original deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb"
.format((MAX_DOC_UPLOAD_SIZE / 1024) / 1024, (texto_original.size / 1024) / 1024))
if texto_original:
validar_arquivo(texto_original, "Texto Original")
return cleaned_data
@ -357,9 +355,8 @@ class DocumentoAcessorioForm(FileFieldCheckMixin, ModelForm):
arquivo = self.cleaned_data.get('arquivo', False)
if arquivo and arquivo.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Texto Integral deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb"
.format((MAX_DOC_UPLOAD_SIZE / 1024) / 1024, (arquivo.size / 1024) / 1024))
if arquivo:
validar_arquivo(arquivo, "Texto Integral")
return self.cleaned_data
@ -1934,9 +1931,8 @@ class ProposicaoForm(FileFieldCheckMixin, forms.ModelForm):
def clean_texto_original(self):
texto_original = self.cleaned_data.get('texto_original', False)
if texto_original and texto_original.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Texto Original deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb"
.format((MAX_DOC_UPLOAD_SIZE / 1024) / 1024, (texto_original.size / 1024) / 1024))
if texto_original:
validar_arquivo(texto_original, "Texto Original")
return texto_original

20
sapl/materia/migrations/0061_auto_20191118_2036.py

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-11-18 23:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('materia', '0060_auto_20190930_1136'),
]
operations = [
migrations.AlterField(
model_name='documentoacessorio',
name='autor',
field=models.CharField(blank=True, max_length=200, verbose_name='Autor'),
),
]

37
sapl/materia/migrations/0061_auto_20191120_1440.py

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-11-20 17:40
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.materia.models
import sapl.utils
class Migration(migrations.Migration):
dependencies = [
('materia', '0060_auto_20190930_1136'),
]
operations = [
migrations.AlterField(
model_name='documentoacessorio',
name='arquivo',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.materia.models.anexo_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Integral'),
),
migrations.AlterField(
model_name='documentoacessorio',
name='autor',
field=models.CharField(blank=True, max_length=200, verbose_name='Autor'),
),
migrations.AlterField(
model_name='materialegislativa',
name='texto_original',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.materia.models.materia_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original'),
),
migrations.AlterField(
model_name='proposicao',
name='texto_original',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.materia.models.materia_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Original'),
),
]

6
sapl/materia/models.py

@ -257,7 +257,7 @@ class MateriaLegislativa(models.Model):
'materia_principal',
'materia_anexada'))
texto_original = models.FileField(
max_length=200,
max_length=300,
blank=True,
null=True,
upload_to=materia_upload_path,
@ -541,7 +541,7 @@ class DocumentoAcessorio(models.Model):
arquivo = models.FileField(
blank=True,
null=True,
max_length=255,
max_length=300,
upload_to=anexo_upload_path,
verbose_name=_('Texto Integral'),
storage=OverwriteStorage(),
@ -807,7 +807,7 @@ class Proposicao(models.Model):
('I', 'Incorporada')),
verbose_name=_('Status Proposição'))
texto_original = models.FileField(
max_length=200,
max_length=300,
upload_to=materia_upload_path,
blank=True,
null=True,

38
sapl/norma/forms.py

@ -1,27 +1,28 @@
import django_filters
import logging
from sapl.crispy_layout_mixin import SaplFormHelper
from crispy_forms.layout import Fieldset, Layout
from django import forms
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models
from django.db.models import Q
from django.forms import ModelForm, widgets, ModelChoiceField
from django.forms import ModelChoiceField, ModelForm, widgets
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
import django_filters
from sapl.base.models import Autor, TipoAutor
from sapl.crispy_layout_mixin import form_actions, to_row
from sapl.crispy_layout_mixin import form_actions, SaplFormHelper, to_row
from sapl.materia.forms import choice_anos_com_materias
from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa
from sapl.settings import MAX_DOC_UPLOAD_SIZE
from sapl.utils import NormaPesquisaOrderingFilter, RangeWidgetOverride, \
choice_anos_com_normas, FilterOverridesMetaMixin, FileFieldCheckMixin, ANO_CHOICES
from sapl.materia.models import (MateriaLegislativa,
TipoMateriaLegislativa)
from sapl.utils import (ANO_CHOICES, choice_anos_com_normas,
FileFieldCheckMixin, FilterOverridesMetaMixin,
NormaPesquisaOrderingFilter, RangeWidgetOverride,
validar_arquivo)
from .models import (AnexoNormaJuridica, AssuntoNorma, NormaJuridica, NormaRelacionada,
TipoNormaJuridica, AutoriaNorma)
from .models import (AnexoNormaJuridica, AssuntoNorma, AutoriaNorma,
NormaJuridica, NormaRelacionada, TipoNormaJuridica)
def get_esferas():
@ -200,9 +201,8 @@ class NormaJuridicaForm(FileFieldCheckMixin, ModelForm):
texto_integral = self.cleaned_data.get('texto_integral', False)
if texto_integral and texto_integral.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Texto Integral deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (texto_integral.size/1024)/1024))
if texto_integral:
validar_arquivo(texto_integral, "Texto Integral")
return texto_integral
@ -269,7 +269,10 @@ class AnexoNormaJuridicaForm(FileFieldCheckMixin, ModelForm):
logger = logging.getLogger(__name__)
anexo_arquivo = forms.FileField(required=True)
anexo_arquivo = forms.FileField(
required=True,
label="Arquivo Anexo"
)
class Meta:
model = AnexoNormaJuridica
@ -286,9 +289,8 @@ class AnexoNormaJuridicaForm(FileFieldCheckMixin, ModelForm):
anexo_arquivo = self.cleaned_data.get('anexo_arquivo', False)
if anexo_arquivo and anexo_arquivo.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O Arquivo Anexo deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (anexo_arquivo.size/1024)/1024))
if anexo_arquivo:
validar_arquivo(anexo_arquivo, "Arquivo Anexo")
return cleaned_data

22
sapl/norma/migrations/0028_auto_20191024_1330.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-10-24 16:30
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.norma.models
import sapl.utils
class Migration(migrations.Migration):
dependencies = [
('norma', '0027_auto_20191001_1115'),
]
operations = [
migrations.AlterField(
model_name='normajuridica',
name='texto_integral',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.norma.models.norma_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Texto Integral'),
),
]

22
sapl/norma/migrations/0029_auto_20191024_1344.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-10-24 16:44
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.norma.models
import sapl.utils
class Migration(migrations.Migration):
dependencies = [
('norma', '0028_auto_20191024_1330'),
]
operations = [
migrations.AlterField(
model_name='anexonormajuridica',
name='anexo_arquivo',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.norma.models.norma_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Arquivo Anexo'),
),
]

4
sapl/norma/models.py

@ -79,7 +79,7 @@ class NormaJuridica(models.Model):
)
texto_integral = models.FileField(
max_length=200,
max_length=300,
blank=True,
null=True,
upload_to=norma_upload_path,
@ -357,7 +357,7 @@ class AnexoNormaJuridica(models.Model):
max_length=250
)
anexo_arquivo = models.FileField(
max_length=200,
max_length=300,
blank=True,
null=True,
upload_to=norma_upload_path,

46
sapl/protocoloadm/forms.py

@ -1,13 +1,11 @@
import django_filters
import logging
from crispy_forms.bootstrap import InlineRadios, Alert, FormActions
from crispy_forms.layout import (Button, Column, Div, Fieldset, HTML,
Layout, Submit)
from sapl.base.signals import post_save_signal
from sapl.crispy_layout_mixin import SaplFormHelper
from crispy_forms.layout import HTML, Button, Column, Fieldset, Layout, Div, Submit
from django import forms
from sapl.settings import MAX_DOC_UPLOAD_SIZE
from django.core.exceptions import (MultipleObjectsReturned,
ObjectDoesNotExist, ValidationError)
from django.db import models, transaction
@ -15,24 +13,28 @@ from django.db.models import Max
from django.forms import ModelForm
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
import django_filters
from sapl.base.models import Autor, TipoAutor, AppConfig
from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row
from sapl.materia.models import (MateriaLegislativa, TipoMateriaLegislativa,
from sapl.base.signals import post_save_signal
from sapl.crispy_layout_mixin import (form_actions, SaplFormHelper,
SaplFormLayout, to_row)
from sapl.materia.models import (MateriaLegislativa,
TipoMateriaLegislativa,
UnidadeTramitacao)
from sapl.protocoloadm.models import Protocolo
from sapl.utils import (RANGE_ANOS, YES_NO_CHOICES, AnoNumeroOrderingFilter,
RangeWidgetOverride, autor_label, autor_modal,
choice_anos_com_protocolo, choice_force_optional,
from sapl.utils import (AnoNumeroOrderingFilter, autor_label, autor_modal,
choice_anos_com_documentoadministrativo,
FilterOverridesMetaMixin, choice_anos_com_materias,
FileFieldCheckMixin, lista_anexados)
choice_anos_com_materias,
choice_anos_com_protocolo, choice_force_optional,
FileFieldCheckMixin, FilterOverridesMetaMixin,
lista_anexados, RangeWidgetOverride, RANGE_ANOS,
validar_arquivo, YES_NO_CHOICES)
from .models import (AcompanhamentoDocumento, DocumentoAcessorioAdministrativo,
DocumentoAdministrativo,
Protocolo, TipoDocumentoAdministrativo,
TramitacaoAdministrativo, Anexado)
from .models import (Anexado, AcompanhamentoDocumento,
DocumentoAcessorioAdministrativo,
DocumentoAdministrativo, Protocolo,
TipoDocumentoAdministrativo,
TramitacaoAdministrativo)
TIPOS_PROTOCOLO = [('0', 'Recebido'), ('1', 'Enviado'),
@ -666,9 +668,8 @@ class DocumentoAcessorioAdministrativoForm(FileFieldCheckMixin, ModelForm):
arquivo = self.cleaned_data.get('arquivo', False)
if arquivo and arquivo.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (arquivo.size/1024)/1024))
if arquivo:
validar_arquivo(arquivo, "Arquivo")
return self.cleaned_data
@ -1159,9 +1160,8 @@ class DocumentoAdministrativoForm(FileFieldCheckMixin, ModelForm):
texto_integral = self.cleaned_data.get('texto_integral', False)
if texto_integral and texto_integral.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Texto Integral deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (texto_integral.size/1024)/1024))
if texto_integral:
validar_arquivo(texto_integral, "Texto Integral")
return self.cleaned_data

20
sapl/protocoloadm/migrations/0026_auto_20191118_2036.py

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-11-18 23:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0025_auto_20191001_1115'),
]
operations = [
migrations.AlterField(
model_name='documentoacessorioadministrativo',
name='autor',
field=models.CharField(blank=True, max_length=200, verbose_name='Autor'),
),
]

31
sapl/protocoloadm/migrations/0026_auto_20191120_1440.py

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-11-20 17:40
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.utils
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0025_auto_20191001_1115'),
]
operations = [
migrations.AlterField(
model_name='documentoacessorioadministrativo',
name='arquivo',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.utils.texto_upload_path, verbose_name='Arquivo'),
),
migrations.AlterField(
model_name='documentoacessorioadministrativo',
name='autor',
field=models.CharField(blank=True, max_length=200, verbose_name='Autor'),
),
migrations.AlterField(
model_name='documentoadministrativo',
name='texto_integral',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.utils.texto_upload_path, verbose_name='Texto Integral'),
),
]

4
sapl/protocoloadm/models.py

@ -164,7 +164,7 @@ class DocumentoAdministrativo(models.Model):
observacao = models.TextField(
blank=True, verbose_name=_('Observação'))
texto_integral = models.FileField(
max_length=200,
max_length=300,
blank=True,
null=True,
storage=OverwriteStorage(),
@ -232,7 +232,7 @@ class DocumentoAcessorioAdministrativo(models.Model):
verbose_name=_('Tipo'))
nome = models.CharField(max_length=30, verbose_name=_('Nome'))
arquivo = models.FileField(
max_length=200,
max_length=300,
blank=True,
null=True,
upload_to=texto_upload_path,

74
sapl/sessao/forms.py

@ -1,6 +1,8 @@
import django_filters
from crispy_forms.layout import Button, Fieldset, HTML, Layout
from datetime import datetime
from crispy_forms.layout import HTML, Button, Fieldset, Layout
from django import forms
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist, ValidationError
@ -9,26 +11,28 @@ from django.db.models import Q
from django.forms import ModelForm
from django.forms.widgets import CheckboxSelectMultiple
from django.utils.translation import ugettext_lazy as _
import django_filters
from sapl.settings import MAX_DOC_UPLOAD_SIZE
from sapl.base.models import Autor, TipoAutor
from sapl.crispy_layout_mixin import SaplFormHelper
from sapl.crispy_layout_mixin import form_actions, to_row, SaplFormLayout
from sapl.crispy_layout_mixin import (form_actions, to_row,
SaplFormHelper, SaplFormLayout)
from sapl.materia.forms import MateriaLegislativaFilterSet
from sapl.materia.models import (MateriaLegislativa, StatusTramitacao,
TipoMateriaLegislativa)
from sapl.parlamentares.models import Parlamentar, Mandato
from sapl.utils import (RANGE_DIAS_MES, RANGE_MESES,
MateriaPesquisaOrderingFilter, autor_label,
autor_modal, timezone, choice_anos_com_sessaoplenaria,
FileFieldCheckMixin)
from .models import (Bancada, ExpedienteMateria, JustificativaAusencia,
Orador, OradorExpediente, OrdemDia, PresencaOrdemDia, SessaoPlenaria,
SessaoPlenariaPresenca, TipoResultadoVotacao,
OcorrenciaSessao, RetiradaPauta, TipoRetiradaPauta, OradorOrdemDia, ORDENACAO_RESUMO,
ResumoOrdenacao, RegistroLeitura)
from sapl.parlamentares.models import Mandato, Parlamentar
from sapl.utils import (autor_label, autor_modal,
choice_anos_com_sessaoplenaria,
FileFieldCheckMixin,
MateriaPesquisaOrderingFilter,
RANGE_DIAS_MES, RANGE_MESES,
timezone, validar_arquivo)
from .models import (Bancada, ExpedienteMateria,
JustificativaAusencia, OcorrenciaSessao, Orador,
OradorExpediente, OradorOrdemDia, OrdemDia,
ORDENACAO_RESUMO, PresencaOrdemDia,
RegistroLeitura, ResumoOrdenacao, RetiradaPauta,
SessaoPlenaria, SessaoPlenariaPresenca,
TipoResultadoVotacao, TipoRetiradaPauta)
MES_CHOICES = RANGE_MESES
@ -155,18 +159,14 @@ class SessaoPlenariaForm(FileFieldCheckMixin, ModelForm):
upload_ata = self.cleaned_data.get('upload_ata', False)
upload_anexo = self.cleaned_data.get('upload_anexo', False)
if upload_pauta and upload_pauta.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Pauta da Sessão deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (upload_pauta.size/1024)/1024))
if upload_ata and upload_ata.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Ata da Sessão deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (upload_ata.size/1024)/1024))
if upload_anexo and upload_anexo.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Anexo da Sessão deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (upload_anexo.size/1024)/1024))
if upload_pauta:
validar_arquivo(upload_pauta, "Pauta da Sessão")
if upload_ata:
validar_arquivo(upload_ata, "Ata da Sessão")
if upload_anexo:
validar_arquivo(upload_anexo, "Anexo da Sessão")
return self.cleaned_data
@ -683,9 +683,8 @@ class OradorForm(ModelForm):
upload_anexo = self.cleaned_data.get('upload_anexo', False)
if upload_anexo and upload_anexo.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Anexo do Orador deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (upload_anexo.size/1024)/1024))
if upload_anexo:
validar_arquivo(upload_anexo, "Anexo do Orador")
return self.cleaned_data
@ -724,9 +723,8 @@ class OradorExpedienteForm(ModelForm):
upload_anexo = self.cleaned_data.get('upload_anexo', False)
if upload_anexo and upload_anexo.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Anexo do Orador deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (upload_anexo.size/1024)/1024))
if upload_anexo:
validar_arquivo(upload_anexo, "Anexo do Orador")
return self.cleaned_data
@ -767,9 +765,8 @@ class OradorOrdemDiaForm(ModelForm):
upload_anexo = self.cleaned_data.get('upload_anexo', False)
if upload_anexo and upload_anexo.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Anexo do Orador deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (upload_anexo.size/1024)/1024))
if upload_anexo:
validar_arquivo(upload_anexo, "Anexo do Orador")
return self.cleaned_data
@ -1011,9 +1008,8 @@ class JustificativaAusenciaForm(ModelForm):
upload_anexo = self.cleaned_data.get('upload_anexo', False)
if upload_anexo and upload_anexo.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError("O arquivo Anexo de Justificativa deve ser menor que {0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb" \
.format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (upload_anexo.size/1024)/1024))
if upload_anexo:
validar_arquivo(upload_anexo, "Anexo de Justificativa")
if not sessao_plenaria.finalizada or sessao_plenaria.finalizada is None:
raise ValidationError(

32
sapl/sessao/migrations/0048_auto_20191029_1418.py

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-10-29 17:18
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.sessao.models
import sapl.utils
class Migration(migrations.Migration):
dependencies = [
('sessao', '0047_auto_20190829_1253'),
]
operations = [
migrations.AlterField(
model_name='sessaoplenaria',
name='upload_anexo',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.sessao.models.anexo_upload_path, verbose_name='Anexo da Sessão'),
),
migrations.AlterField(
model_name='sessaoplenaria',
name='upload_ata',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.sessao.models.ata_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Ata da Sessão'),
),
migrations.AlterField(
model_name='sessaoplenaria',
name='upload_pauta',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.sessao.models.pauta_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Pauta da Sessão'),
),
]

32
sapl/sessao/migrations/0049_auto_20191029_1434.py

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-10-29 17:34
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.sessao.models
import sapl.utils
class Migration(migrations.Migration):
dependencies = [
('sessao', '0048_auto_20191029_1418'),
]
operations = [
migrations.AlterField(
model_name='orador',
name='upload_anexo',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.sessao.models.anexo_upload_path, verbose_name='Anexo do Orador'),
),
migrations.AlterField(
model_name='oradorexpediente',
name='upload_anexo',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.sessao.models.anexo_upload_path, verbose_name='Anexo do Orador'),
),
migrations.AlterField(
model_name='oradorordemdia',
name='upload_anexo',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.sessao.models.anexo_upload_path, verbose_name='Anexo do Orador'),
),
]

22
sapl/sessao/migrations/0050_auto_20191029_1441.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-10-29 17:41
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.sessao.models
import sapl.utils
class Migration(migrations.Migration):
dependencies = [
('sessao', '0049_auto_20191029_1434'),
]
operations = [
migrations.AlterField(
model_name='justificativaausencia',
name='upload_anexo',
field=models.FileField(blank=True, max_length=300, null=True, storage=sapl.utils.OverwriteStorage(), upload_to=sapl.sessao.models.anexo_upload_path, verbose_name='Anexo de Justificativa'),
),
]

10
sapl/sessao/models.py

@ -182,7 +182,7 @@ class SessaoPlenaria(models.Model):
max_length=150, blank=True,
verbose_name=_('URL Arquivo Vídeo (Formatos MP4 / FLV / WebM)'))
upload_pauta = models.FileField(
max_length=200,
max_length=300,
blank=True,
null=True,
upload_to=pauta_upload_path,
@ -190,7 +190,7 @@ class SessaoPlenaria(models.Model):
storage=OverwriteStorage(),
validators=[restringe_tipos_de_arquivo_txt])
upload_ata = models.FileField(
max_length=200,
max_length=300,
blank=True,
null=True,
upload_to=ata_upload_path,
@ -198,7 +198,7 @@ class SessaoPlenaria(models.Model):
verbose_name=_('Ata da Sessão'),
validators=[restringe_tipos_de_arquivo_txt])
upload_anexo = models.FileField(
max_length=200,
max_length=300,
blank=True,
null=True,
storage=OverwriteStorage(),
@ -436,7 +436,7 @@ class AbstractOrador(models.Model): # Oradores
observacao = models.CharField(
max_length=150, blank=True, verbose_name=_('Observação'))
upload_anexo = models.FileField(
max_length=200,
max_length=300,
blank=True,
null=True,
storage=OverwriteStorage(),
@ -788,7 +788,7 @@ class JustificativaAusencia(models.Model):
OrdemDia, blank=True, verbose_name=_('Matérias do Ordem do Dia'))
upload_anexo = models.FileField(
max_length=200,
max_length=300,
blank=True,
null=True,
storage=OverwriteStorage(),

49
sapl/utils.py

@ -1,12 +1,20 @@
from functools import wraps
import django_filters
import hashlib
from operator import itemgetter
import logging
import magic
import os
import re
from unicodedata import normalize as unicodedata_normalize
import unicodedata
import logging
from crispy_forms.layout import HTML, Button
from crispy_forms.layout import Button, HTML
from easy_thumbnails import source_generators
from floppyforms import ClearableFileInput
from functools import wraps
from operator import itemgetter
from reversion_compare.admin import CompareVersionAdmin
from unicodedata import normalize as unicodedata_normalize
from unipath.path import Path
from django import forms
from django.apps import apps
from django.conf import settings
@ -14,6 +22,7 @@ from django.contrib import admin
from django.contrib.contenttypes.fields import (GenericForeignKey, GenericRel,
GenericRelation)
from django.core.exceptions import ValidationError
from django.core.files.storage import FileSystemStorage
from django.core.files.uploadedfile import UploadedFile
from django.core.mail import get_connection
from django.db import models
@ -23,16 +32,11 @@ from django.forms.widgets import SplitDateTimeWidget
from django.utils import six, timezone
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.core.files.storage import FileSystemStorage
import django_filters
from easy_thumbnails import source_generators
from floppyforms import ClearableFileInput
import magic
from reversion_compare.admin import CompareVersionAdmin
from unipath.path import Path
from sapl.crispy_layout_mixin import SaplFormHelper
from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row
from sapl.crispy_layout_mixin import (form_actions, SaplFormHelper,
SaplFormLayout, to_row)
from sapl.settings import MAX_DOC_UPLOAD_SIZE
# (26/10/2018): O separador foi mudador de '/' para 'K'
# por conta dos leitores de códigos de barra, que trocavam
@ -40,6 +44,23 @@ from sapl.crispy_layout_mixin import SaplFormLayout, form_actions, to_row
SEPARADOR_HASH_PROPOSICAO = 'K'
def validar_arquivo(arquivo, nome_campo):
if len(arquivo.name) > 200:
raise ValidationError(
"Certifique-se de que o nome do arquivo no " \
"campo '" + nome_campo + "' tenha no máximo 200 caracteres " \
"(ele possui {})".format(len(arquivo.name))
)
if arquivo.size > MAX_DOC_UPLOAD_SIZE:
raise ValidationError(
"O arquivo " + nome_campo + " deve ser menor que " \
"{0:.1f} mb, o tamanho atual desse arquivo é {1:.1f} mb".format(
(MAX_DOC_UPLOAD_SIZE/1024)/1024,
(arquivo.size/1024)/1024
)
)
def pil_image(source, exif_orientation=False, **options):
return source_generators.pil_image(source, exif_orientation, **options)

Loading…
Cancel
Save