greathector7

got an unexpected keyword argument 'pk'

Sep 25th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.88 KB | None | 0 0
  1. LA URL:
  2. path('nacimientos_rp/<int:pk>/',
  3.          login_required(views.r1180_RPnacimientos),
  4.          name='nacimientos_rp'),
  5.  
  6.  
  7. LA VISTA:
  8. import time
  9. from io import BytesIO
  10. from reportlab.pdfgen import canvas
  11. from django.http import HttpResponse
  12. from reportlab.lib.enums import TA_JUSTIFY
  13. from reportlab.lib.pagesizes import letter, legal
  14. from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image
  15. from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
  16. from reportlab.lib.units import cm
  17. # bases de datos necesarias
  18. from ..models import Prefec
  19. import logging
  20. # configuracion basica de logging:
  21. logging.basicConfig(level=logging.DEBUG,
  22.     format='%(asctime)s - %(levelname)s -%(filename)s:%(lineno)d - %(message)s')
  23.  
  24.  
  25. def r1180_RPnacimientos(request):
  26.     # el response permite enviar el pdf
  27.     response = HttpResponse(content_type='application/pdf')
  28.     # buff permite crear un espacio en la memoria para trabajar el reporte
  29.     buff = BytesIO()
  30.     # configuracion inicial para el documento
  31.     doc = SimpleDocTemplate(buff, pagesize=letter,
  32.                                   rightMargin=2 * cm, leftMargin=2 * cm,
  33.                                   topMargin=3 * cm, bottomMargin=2 * cm,
  34.                                   showBoundary=1)
  35.     # inicializamos el story que es el guion logico para la creacion del pdf
  36.     Story = []
  37.  
  38.     logo = "./static/base/images/logo_reporte.png"
  39.     magName = "RegistroCivilSantiagoMariño"
  40.     issueNum = 12
  41.     subPrice = "99.00"
  42.     limitedDate = "03/05/2010"
  43.     freeGift = "tin foil hat"
  44.  
  45.     formatted_time = time.ctime()
  46.    
  47.     styles = getSampleStyleSheet()
  48.    
  49.     # se puede modificar los valores del parrafo para que el mimso se adapte a nuestras necesidades
  50.     styles.add(ParagraphStyle(name='Justify',
  51.                               alignment=TA_JUSTIFY,
  52.                               leading=20,
  53.                               fontSize=14))
  54.     Story.append(Spacer(1, 12))
  55.     allprefectura = [(p.pre_mun, p.pre_ciu, p.prefectura, p.tprefec2)
  56.                     for p in Prefec.objects.all()]
  57.  
  58.     ptext3 = '''
  59. IDENTIDAD Nº E-82.277.499 DE ESTE DOMICILIO, SEGUN CONSTA DE ACTA Nº 548.- ELABORADA EN ESTA FECHA Y POR ANTE
  60. ESTE DESPACHO Certifica: Que es copia fiel y exacta de su original que se expide a peticion de la parte
  61. interesada en  a los 10 dias del mes de Octubre del 2017.-
  62. '''
  63.     Story.append(Paragraph(ptext3, styles["Justify"]))
  64.     # Story.append(Paragraph(ptext3, styles["textoPartidas"]))
  65.     Story.append(Spacer(1, 12))
  66.  
  67.  
  68.     ptext = 'Abog. <font size=12><b>YENITZA PERDOMO SANCHEZ</b></font>'
  69.     Story.append(Paragraph(ptext, styles["Justify"]))
  70.     # Story.append(Spacer(1, 1))
  71.     ptext = '<b>Directora Del Registro Civil</b>'
  72.     Story.append(Paragraph(ptext, styles["Justify"]))
  73.     doc.build(Story)
  74.     response.write(buff.getvalue())
  75.     return response
Add Comment
Please, Sign In to add comment