コード例 #1
0
ファイル: views.py プロジェクト: RubenAlvarenga/nhakanina
    def post(self, request, *args, **kwargs):
        checks = request.POST.getlist('checks')
        if not checks:
            mensaje = msg_render("<strong>Favor seleccione por lo menos un item</strong>")
            messages.add_message(request, messages.INFO, mensaje)
            url = request.META['HTTP_REFERER']
            return HttpResponseRedirect(url)

        sort=request.POST.get('sort')
        ids = map(int, checks)
        recibos=Recibo.objects.filter(pk__in=ids)
        accion=request.POST.get('accion')

        table = RecibosTablePDF(recibos)
        if sort!='None':
            table.order_by = sort 

        if accion=='A csv':
            RequestConfig(request).configure(table)
            return export_table_to_csv(Recibo, request, table)

        elif accion=='A pdf':
            table.model=Recibo
            RequestConfig(request).configure(table)            
            pdf_name = 'base/generic_pdf_list.html'
            return PDFTemplateResponse(request, pdf_name, {'table':table})

        elif accion=='Eliminar':
            mensaje = "ACCESO RESTRINGIDO | solo es posible la Anulacion"
            messages.add_message(request, messages.ERROR, mensaje, extra_tags='danger')
            url = request.META['HTTP_REFERER']
            return HttpResponseRedirect(url)
コード例 #2
0
ファイル: views.py プロジェクト: RubenAlvarenga/kuriju
    def post(self, request, *args, **kwargs):
        checks = request.POST.getlist('checks')
        sort=request.POST.get('sort')
        ids = map(int, checks)
        departamentos=departamento.objects.filter(pk__in=ids)
        accion=request.POST.get('accion')
        
        table = departamentosTablePDF(departamentos)
        if sort!='None':
            table.order_by = sort 
        if accion=='A csv':
            RequestConfig(request).configure(table)
            return export_table_to_csv(departamento, request, table)
        elif accion=='A pdf':
            table.model=departamento
            RequestConfig(request).configure(table)            
            pdf_name = 'base/generic_pdf_list.html'
            return PDFTemplateResponse(request, pdf_name, {'table':table})

        elif accion=='Eliminar':
            perm = 'departamento.delete_departamento'
            if request.user.has_perm(perm):
                if request.POST.get("confirmar")=='True':
                    return eliminar_bulk(request, departamentos)
                else:
                    dic={'object_list':departamentos}
                    template_name='base/generic_delete.html'
                    return render_to_response(template_name, dic, context_instance=RequestContext(request, locals()))
            else:
                mensaje = "ACCESO RESTRINGIDO | Permiso Requerido: "+str(perm)
                messages.add_message(request, messages.ERROR, mensaje, extra_tags='danger')
                url = request.META['HTTP_REFERER']
                return HttpResponseRedirect(url)
コード例 #3
0
ファイル: views.py プロジェクト: RubenAlvarenga/kuriju
    def post(self, request, *args, **kwargs):
        checks = request.POST.getlist('checks')
        if not checks:
            mensaje = msg_render("<strong>Favor seleccione por lo menos un item</strong>")
            messages.add_message(request, messages.INFO, mensaje)
            url = request.META['HTTP_REFERER']
            return HttpResponseRedirect(url)


        sort=request.POST.get('sort')
        ids = map(int, checks)
        clientes=view_cliente.objects.filter(pk__in=ids)
        accion=request.POST.get('accion')
        
        table = clientesTablePDF(clientes)
        if sort!='None':
            table.order_by = sort 

        if accion=='A csv':
            RequestConfig(request).configure(table)
            return export_table_to_csv(cliente, request, table)

        elif accion=='A pdf':
            table.model=cliente
            RequestConfig(request).configure(table)            
            pdf_name = 'base/generic_pdf_list.html'
            return PDFTemplateResponse(request, pdf_name, {'table':table})
コード例 #4
0
ファイル: views.py プロジェクト: RubenAlvarenga/nhakanina
    def post(self, request, *args, **kwargs):
        checks = request.POST.getlist("checks")
        if not checks:
            mensaje = msg_render("<strong>Favor seleccione por lo menos un item</strong>")
            messages.add_message(request, messages.INFO, mensaje)
            url = request.META["HTTP_REFERER"]
            return HttpResponseRedirect(url)

        sort = request.POST.get("sort")
        ids = map(int, checks)
        descuentos = Descuento.objects.filter(pk__in=ids)
        accion = request.POST.get("accion")

        table = DescuentoTablePDF(descuentos)
        if sort != "None":
            table.order_by = sort

        if accion == "A csv":
            RequestConfig(request).configure(table)
            return export_table_to_csv(Descuento, request, table)

        elif accion == "A pdf":
            table.model = self.model
            RequestConfig(request).configure(table)
            pdf_name = "base/generic_pdf_list.html"
            return PDFTemplateResponse(
                request, pdf_name, {"table": table, "request": self.get_context_data.im_self.request}
            )

        elif accion == "Eliminar":
            perm = "descuentos.delete_descuento"
            if request.user.has_perm(perm):
                if request.POST.get("confirmar") == "True":
                    return eliminar_bulk(request, descuentos)
                else:
                    dic = {"object_list": descuentos}
                    template_name = "base/generic_delete.html"
                    return render_to_response(template_name, dic, context_instance=RequestContext(request, locals()))
            else:
                mensaje = "ACCESO RESTRINGIDO | Permiso Requerido: " + str(perm)
                messages.add_message(request, messages.ERROR, mensaje, extra_tags="danger")
                url = request.META["HTTP_REFERER"]
                return HttpResponseRedirect(url)
コード例 #5
0
ファイル: views.py プロジェクト: RubenAlvarenga/nhakanina
    def post(self, request, *args, **kwargs):
        checks = request.POST.getlist('checks')
        if not checks:
            mensaje = msg_render("<strong>Favor seleccione por lo menos un item</strong>")
            messages.add_message(request, messages.INFO, mensaje)
            url = request.META['HTTP_REFERER']
            return HttpResponseRedirect(url)

        sort=request.POST.get('sort')
        ids = map(int, checks)
        materias=Materia.objects.filter(pk__in=ids)
        accion=request.POST.get('accion')
        
        table = MateriasTablePDF(materias)
        if sort!='None':
            table.order_by = sort 

        if accion=='A csv':
            RequestConfig(request).configure(table)
            return export_table_to_csv(Materia, request, table)

        elif accion=='A pdf':
            table.model=self.model
            RequestConfig(request).configure(table)    
            pdf_name = 'base/generic_pdf_list.html'
            return PDFTemplateResponse(request , pdf_name, {'table':table, 'request': self.get_context_data.im_self.request})

        elif accion=='Eliminar':
            perm = 'catedras.delete_carrera'
            if request.user.has_perm(perm):
                if request.POST.get("confirmar")=='True':
                    return eliminar_bulk(request, materias)
                else:
                    dic={'object_list':materias}
                    template_name='base/generic_delete.html'
                    return render_to_response(template_name, dic, context_instance=RequestContext(request, locals()))
            else:
                mensaje = "ACCESO RESTRINGIDO | Permiso Requerido: "+str(perm)
                messages.add_message(request, messages.ERROR, mensaje, extra_tags='danger')
                url = request.META['HTTP_REFERER']
                return HttpResponseRedirect(url)
コード例 #6
0
ファイル: views.py プロジェクト: RubenAlvarenga/nhakanina
def csvRendicion(request, pk):
    rendicion=Rendicion.objects.get(pk=int(pk))
    recibos=rendicion.recibos.all().order_by('nro_recibo')
    table = RecibosTableCSV(recibos)
    RequestConfig(request).configure(table)
    return export_table_to_csv(rendicion, request, table)