Ejemplo n.º 1
0
def manage_news_list(req):
    start, end, index = get_start_end(req, NUMBER_PER_PAGE)
    order_by = req.GET.get("order_by", "-time")
    page = 1
    news_list, length = news.get_order_news(order_by, start, end)
    if length != 0:
        page = ceil(length / NUMBER_PER_PAGE)
    return render_to_response("admins/newss.html",
                              {"news_list": news_list, "oder_by": order_by, "page": range(1, page + 1), "index": index})
Ejemplo n.º 2
0
def manage_user_list(req):
    start, end, index = get_start_end(req, NUMBER_PER_PAGE)
    order_by = req.GET.get("order_by", "-created")
    page = 1
    user_list, length = users.get_order_users(order_by, start, end)
    if length != 0:
        page = ceil(length / NUMBER_PER_PAGE)
    return render_to_response("admins/users.html",
                              {"user_list": user_list, "oder_by": order_by, "page": range(1, page + 1), "index": index})
Ejemplo n.º 3
0
def manage_rank_list(req):
    start, end, index = get_start_end(req, NUMBER_PER_PAGE)
    length = 0
    page = 1
    user_list, count = users.get_order_users("-bonus", start, end)
    if length != 0:
        page = ceil(length / NUMBER_PER_PAGE)
    ranks = range(start + 1, end + 1)

    return render_to_response("admins/rank.html",
                              {"user_dict": dict(zip(ranks, user_list)), "page": range(1, page + 1), "index": index})
Ejemplo n.º 4
0
def manage_news_list(req):
    start, end, index = get_start_end(req, NUMBER_PER_PAGE)
    order_by = req.GET.get("order_by", "-time")
    page = 1
    news_list, length = news.get_order_news(order_by, start, end)
    if length != 0:
        page = ceil(length / NUMBER_PER_PAGE)
    return render_to_response(
        "admins/newss.html", {
            "news_list": news_list,
            "oder_by": order_by,
            "page": range(1, page + 1),
            "index": index
        })
Ejemplo n.º 5
0
def manage_user_list(req):
    start, end, index = get_start_end(req, NUMBER_PER_PAGE)
    order_by = req.GET.get("order_by", "-created")
    page = 1
    user_list, length = users.get_order_users(order_by, start, end)
    if length != 0:
        page = ceil(length / NUMBER_PER_PAGE)
    return render_to_response(
        "admins/users.html", {
            "user_list": user_list,
            "oder_by": order_by,
            "page": range(1, page + 1),
            "index": index
        })
Ejemplo n.º 6
0
def manage_rank_list(req):
    start, end, index = get_start_end(req, NUMBER_PER_PAGE)
    length = 0
    page = 1
    user_list, count = users.get_order_users("-bonus", start, end)
    if length != 0:
        page = ceil(length / NUMBER_PER_PAGE)
    ranks = range(start + 1, end + 1)

    return render_to_response(
        "admins/rank.html", {
            "user_dict": dict(zip(ranks, user_list)),
            "page": range(1, page + 1),
            "index": index
        })
Ejemplo n.º 7
0
def manage_bug_list(req):
    start, end, index = get_start_end(req, NUMBER_PER_PAGE)
    have_seen = req.GET.get("have_seen", "null")
    phone_number = req.GET.get("phone_number", "null")
    length = 0
    page = 1
    user = None
    if phone_number != "null":
        user = users.get_one_user(phone_number)
        if not user:
            record_list = []
        else:
            if have_seen == "null":
                record_list = user.bugrecord_set.all()[start:end]
                length = user.bugrecord_set.count()
            else:
                have_seen = have_seen == "true"
                record_list, length = records.get_records_filter(
                    user.bugrecord_set, have_seen, start, end)
    else:
        if have_seen == "null":
            record_list, length = records.get_records(start, end)
        else:
            have_seen = have_seen == "true"
            record_list, length = records.get_records_filter(
                BugRecord.objects, have_seen, start, end)
    if length != 0:
        page = ceil(length / NUMBER_PER_PAGE)
    if have_seen == "true":
        have_seen = "true"
    elif have_seen == "false":
        have_seen = "false"
    else:
        have_seen = "null"
    return render_to_response(
        "admins/records.html", {
            "record_list": record_list,
            "have_seen": have_seen,
            "page": range(1, page + 1),
            "index": index,
            "user": user,
            "phone_number": phone_number
        })
Ejemplo n.º 8
0
def manage_bug_list(req):
    start, end, index = get_start_end(req, NUMBER_PER_PAGE)
    have_seen = req.GET.get("have_seen", "null")
    phone_number = req.GET.get("phone_number", "null")
    length = 0
    page = 1
    user = None
    if phone_number != "null":
        user = users.get_one_user(phone_number)
        if not user:
            record_list = []
        else:
            if have_seen == "null":
                record_list = user.bugrecord_set.all()[start:end]
                length = user.bugrecord_set.count()
            else:
                have_seen = have_seen == "true"
                record_list, length = records.get_records_filter(user.bugrecord_set, have_seen, start, end)
    else:
        if have_seen == "null":
            record_list, length = records.get_records(start, end)
        else:
            have_seen = have_seen == "true"
            record_list, length = records.get_records_filter(BugRecord.objects, have_seen, start, end)
    if length != 0:
        page = ceil(length / NUMBER_PER_PAGE)
    if have_seen == "true":
        have_seen = "true"
    elif have_seen == "false":
        have_seen = "false"
    else:
        have_seen = "null"
    return render_to_response("admins/records.html",
                              {"record_list": record_list, "have_seen": have_seen, "page": range(1, page + 1),
                               "index": index, "user":
                                   user, "phone_number": phone_number})