Browse Source

Make QA check happy

pull/202/head
Edward Ribeiro 9 years ago
parent
commit
058d2c94c1
  1. 1
      protocoloadm/urls.py
  2. 6
      protocoloadm/views.py
  3. 9
      sapl/utils.py
  4. 6
      templates/protocoloadm/comprovante.html

1
protocoloadm/urls.py

@ -1,4 +1,5 @@
from django.conf.urls import include, url
from protocoloadm.views import (AnularProtocoloAdmView,
ComprovanteProtocoloView,
DetailDocumentoAdministrativo,

6
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):

9
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')

6
templates/protocoloadm/comprovante.html

@ -36,11 +36,13 @@
<tr> <td colspan="2" align="center"><b>COMPROVANTE DE PROTOCOLO</b></td> </tr>
<tr>
<td><center>
<td>
<center>
<img src="{{barcode}}" height="50px" width="170px">
<br>
{{ protocolo.numero|stringformat:'06d' }}
</center></td>
</center>
</td>
<td align="center">Autenticação ??</td>
</tr>

Loading…
Cancel
Save