예제 #1
0
def list():
    results = database_helper.get_all()
    random = []
    nonrandom = []

    for r in results:
        if r.is_random:
            pool = random
        else:
            pool = nonrandom
        pool.append({
            "shortcode": r.shortcode,
            "target_url": r.target_url
        })

    dump = {"random": random, "nonrandom": nonrandom}

    return render_template("admin_list.html", results=dump)
예제 #2
0
def export():
    results = database_helper.get_all()
    arr = map(lambda a: { "is_random": a.is_random, "shortcode": a.shortcode, "target_url": a.target_url }, results)
    js = json.dumps(arr)
    return Response(js, 200, {"Content-Type": "application/json"})