diff --git a/protocoloadm/urls.py b/protocoloadm/urls.py index 4b7dd33e1..bc6d094d7 100644 --- a/protocoloadm/urls.py +++ b/protocoloadm/urls.py @@ -1,4 +1,5 @@ from django.conf.urls import include, url + from protocoloadm.views import (AnularProtocoloAdmView, ComprovanteProtocoloView, DetailDocumentoAdministrativo, diff --git a/protocoloadm/views.py b/protocoloadm/views.py index fefe90656..8fe0a1fd3 100644 --- a/protocoloadm/views.py +++ b/protocoloadm/views.py @@ -1,5 +1,3 @@ -from sapl.utils import create_barcode_128_as_base64_png - from datetime import date, datetime from re import sub @@ -19,6 +17,7 @@ from vanilla import GenericView import sapl from materia.models import Proposicao, TipoMateriaLegislativa from sapl.crud import build_crud +from sapl.utils import create_barcode_128_as_base64_png from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm, ProposicaoSimpleForm, ProtocoloDocumentForm, ProtocoloForm, @@ -328,7 +327,8 @@ class ComprovanteProtocoloView(TemplateView): base64_data = create_barcode_128_as_base64_png(numero.zfill(6)) barcode = 'data:image/png;base64,{0}'.format(base64_data) - return self.render_to_response({"protocolo": protocolo, "barcode": barcode}) + return self.render_to_response({"protocolo": protocolo, + "barcode": barcode}) class ProtocoloMateriaView(FormMixin, GenericView): diff --git a/sapl/utils.py b/sapl/utils.py index d702a79b7..8cf0f453e 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -34,11 +34,14 @@ def xstr(s): def create_barcode_128_as_base64_png(value): from base64 import b64encode - from reportlab.pdfgen import canvas - from reportlab.lib.units import mm, inch from reportlab.graphics.barcode import createBarcodeDrawing - barcode = createBarcodeDrawing('Code128', value = value, barWidth = 170, height=50, fontSize = 2, humanReadable = True) + barcode = createBarcodeDrawing('Code128', + value=value, + barWidth=170, + height=50, + fontSize=2, + humanReadable=True) data = b64encode(barcode.asString('png')) return data.decode('utf-8') diff --git a/templates/protocoloadm/comprovante.html b/templates/protocoloadm/comprovante.html index 20ed3ae5b..d85823a66 100644 --- a/templates/protocoloadm/comprovante.html +++ b/templates/protocoloadm/comprovante.html @@ -36,11 +36,13 @@