Ejemplo n.º 1
0
def print_all(request):




    logging.info("fetch qcards")
    qcard_list=QCard.list_my(request.auth_info.email)
    logging.info("fetch done")
    if qrg.qrg_cfg_get_on():
        logging.info("qrg is on")
        li = []
        for qc in qcard_list:
            li += [db.to_dict(qc)]
        rd = qrg.qrg_post("cards",li)
        pdfdata = base64.b64decode(rd["data"]) 
        r =  HttpResponse(pdfdata, mimetype='application/pdf')
        file_name = urllib.quote("karty.pdf")
        logging.info(file_name)
        r['Content-Disposition'] = "attachment; filename*=UTF-8''%s"%file_name

    else:
        logging.info("qrg is off")
        r =  HttpResponse(mimetype='application/pdf')
        file_name = urllib.quote("karty.pdf")
        logging.info(file_name)
        r['Content-Disposition'] = "attachment; filename*=UTF-8''%s"%file_name
        pdf.students_qcard(r,qcard_list)

    return r
Ejemplo n.º 2
0
def index(request):
    if (request.auth_info.admin):
        qcard_list=QCard.list_all()
    else:
        qcard_list=QCard.list_my(request.auth_info.email)

    return render_to_response('admin/qcards_index.html', RequestContext(request, { 'qcard_list': qcard_list }))