Exemple #1
0
 def get(self, request, *args, **kwargs):
     primary = self.kwargs['pk']
     gatepass = Gatepass.objects.all().get(pk=primary)
     items = Item.objects.all().filter(gatepass=gatepass)
     data = {'gatepass': gatepass, 'items': items}
     pdf = render_to_pdf('gatepass_apply/gatepass_print.html', data)
     return HttpResponse(pdf, content_type='application/pdf')
Exemple #2
0
 def get(self, request, id):
     try:
         resume = Resume.objects.get(pk=id)
         resume_template_path = "resume_templates/pdf/%s.html" %(resume.resume_template.name)
         return render_to_pdf(resume_template_path,{'resume': resume,})
     except Resume.DoesNotExist:
         raise Http404
Exemple #3
0
def pedidoPDF(request, id):
    pedido = get_object_or_404(Pedido, id=id)
    items = PedidoItem.objects.filter(pedido=pedido)
    template = get_template('pedidos/pedido.html')

    context = {
        "pedido": pedido,
        "items": items,

    }
    html = template.render(context)
    pdf = render_to_pdf('pedidos/pedido.html', context)
    if pdf:
        response = HttpResponse(pdf, content_type='application/pdf')
        filename = "Pedido_%s.pdf" %(str(id))
        content = "inline; filename='%s'" % filename
        download = request.GET.get("download")
        if download:
            content = "attachment; filename='%s'" % filename
        response['Content-Disposition'] = content
        return response
    return HttpResponse("Not found")
Exemple #4
0
def reportepdf(request):
    q = Historial_clinico.objects.all()
    contexto = {'history': q}
    pdf = render_to_pdf('Muelitas/historia_clinica.html', contexto)
    response = HttpResponse(pdf, content_type='application/pdf')
    #para abrir el pdf directamente
    response['content-Disposition'] = 'filename=Reporte.pdf'
    #para descargar directamente
    #response ['content-Disposition'] = 'attachment;filename=Reporte.pdf'
    return response


#def eliminarRegistro(request, id):
#        try:
#                q = Usuario.objects.get(pk=id)
#                q.Estado = 'False'
#                q.save()
#                contexto = {'Usuarios': q }
#                #return HttpResponseRedirect(reverse('Muelitas:listarRegistro', args=()))
#                return render(request, 'Muelitas/formulario_listar.html', contexto)
#
#        except Exception as e:
#                return HttpResponse(e)
Exemple #5
0
 def get(self, request, *args, **kwargs):
     primary = self.kwargs['pk']
     visitor = visitor_detail.objects.get(pk=primary)
     data = {'visitor': visitor}
     pdf = render_to_pdf('visitor/card.html', data)
     return HttpResponse(pdf, content_type='application/pdf')
Exemple #6
0
 def get(self, request, *args, **kwargs):
     primary = self.kwargs['pk']
     employee = models.Employee_Card.objects.get(pk=primary)
     data = {'employee': employee}
     pdf = render_to_pdf('card/employee_card.html', data)
     return HttpResponse(pdf, content_type='application/pdf')
Exemple #7
0
 def get(self, request, *args, **kwargs):
     primary = self.kwargs['pk']
     student = models.Card_detail.objects.get(pk=primary)
     data = {'student': student}
     pdf = render_to_pdf('card/card.html', data)
     return HttpResponse(pdf, content_type='application/pdf')