diff --git a/sapl/materia/views.py b/sapl/materia/views.py index a22268545..21c590349 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -51,7 +51,7 @@ from sapl.materia.forms import (AnexadaForm, AutoriaForm, from sapl.norma.models import LegislacaoCitada from sapl.parlamentares.models import Legislatura from sapl.protocoloadm.models import Protocolo -from sapl.settings import MEDIA_ROOT +from sapl.settings import MEDIA_ROOT, MAX_DOC_UPLOAD_SIZE from sapl.utils import (YES_NO_CHOICES, autor_label, autor_modal, SEPARADOR_HASH_PROPOSICAO, gerar_hash_arquivo, get_base_url, get_client_ip, get_mime_type_from_file_extension, montar_row_autor, @@ -2118,6 +2118,13 @@ class DocumentoAcessorioEmLoteView(PermissionRequiredMixin, FilterView): messages.add_message(request, messages.ERROR, msg) return self.get(request, self.kwargs) + if request.FILES['arquivo'].size > MAX_DOC_UPLOAD_SIZE: + msg = _("O arquivo Anexo de Texto Integral deve ser menor que {0:.1f} MB, \ + o tamanho atual desse arquivo é {1:.1f} MB" \ + .format((MAX_DOC_UPLOAD_SIZE/1024)/1024, (request.FILES['arquivo'].size/1024)/1024)) + messages.add_message(request, messages.ERROR, msg) + return self.get(request, self.kwargs) + tmp_name = os.path.join(MEDIA_ROOT, request.FILES['arquivo'].name) with open(tmp_name, 'wb') as destination: for chunk in request.FILES['arquivo'].chunks(): diff --git a/sapl/templates/materia/em_lote/acessorio.html b/sapl/templates/materia/em_lote/acessorio.html index 89fc2fff8..6e5c6ec3e 100644 --- a/sapl/templates/materia/em_lote/acessorio.html +++ b/sapl/templates/materia/em_lote/acessorio.html @@ -22,7 +22,7 @@
- {% for t in tipos_docs %} {% endfor %}
@@ -31,14 +31,14 @@
- +
- +
@@ -47,7 +47,7 @@
- +
@@ -65,7 +65,7 @@
- +