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})
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 })
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)
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)