コード例 #1
0
    def handle(self, *args, **options):
        count = 1
        user_rank = users.get_order_users("bonus")

        for user in user_rank:
            user.rank = count
            count += 1
            user.save()
コード例 #2
0
ファイル: views.py プロジェクト: qujianxin/BugVoteServer
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})
コード例 #3
0
def rank_list_view(req):
    user_list, count = users.get_order_users("-bonus", end=50)
    context = {
        'name':
        req.session.get("name", ''),
        "rank_list":
        dict(map(lambda entry: (entry[0] + 1, entry[1]), enumerate(user_list)))
    }
    return render_to_response("user_rank.html", context)
コード例 #4
0
ファイル: views.py プロジェクト: qujianxin/BugVoteServer
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})
コード例 #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
        })
コード例 #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
        })
コード例 #7
0
ファイル: views.py プロジェクト: qujianxin/BugVoteServer
def index_view(req):
    context = {}
    last_days = (admins.get_end_time() - datetime.now()).days
    if last_days >= 0:
        context['last_days'] = last_days
    else:
        context['last_days'] = "已结束"
    ran_li, count = users.get_order_users("-bonus", end=6)
    context['rank_list'] = dict(map(lambda entry: (entry[0] + 1, entry[1]), enumerate(ran_li)))
    news_li, count = news.get_order_news("time", end=4)
    context['news_list'] = news_li
    pic_list = admins.get_publicity_pictures()
    context['pic_list'] = pic_list
    context['pic_index'] = range(len(pic_list))
    name = req.session.get("name", '')
    if name:
        context['name'] = name
    return render_to_response("index.html", context)
コード例 #8
0
def index_view(req):
    context = {}
    last_days = (admins.get_end_time() - datetime.now()).days
    if last_days >= 0:
        context['last_days'] = last_days
    else:
        context['last_days'] = "已结束"
    ran_li, count = users.get_order_users("-bonus", end=6)
    context['rank_list'] = dict(
        map(lambda entry: (entry[0] + 1, entry[1]), enumerate(ran_li)))
    news_li, count = news.get_order_news("time", end=4)
    context['news_list'] = news_li
    pic_list = admins.get_publicity_pictures()
    context['pic_list'] = pic_list
    context['pic_index'] = range(len(pic_list))
    name = req.session.get("name", '')
    if name:
        context['name'] = name
    return render_to_response("index.html", context)
コード例 #9
0
ファイル: views.py プロジェクト: qujianxin/BugVoteServer
def rank_list_view(req):
    user_list, count = users.get_order_users("-bonus", end=50)
    context = {'name': req.session.get("name", ''),
               "rank_list": dict(map(lambda entry: (entry[0] + 1, entry[1]), enumerate(user_list)))}
    return render_to_response("user_rank.html", context)