def post_list_view(request): list_post = Post.objects.all() context = {'list_post': list_post} context.update(get_read_most_post()) context.update(get_exchange_link()) context.update(get_navbar_item_homepage()) return render(request, 'post/list.html', context=context)
def input_code_view(request): item = InputCode.objects.get_or_create(id=1) if item[1]: code = "代码" else: code = item[0].name context = {'code': code} context.update(get_navbar_item_homepage()) return render(request, 'datacenter/input_code.html', context=context)
def index(request): top_post = Post.objects.filter(is_main_page=True).order_by('-priority') list_post = Post.objects.filter(is_main_page=False) context = {'top_post': top_post, 'list_post': list_post} context.update(get_read_most_post()) context.update(get_exchange_link()) context.update(get_navbar_item_homepage()) context.update(get_feature_post_post()) return render(request, 'post/index.html', context=context)
def detail(request, time_id): post = Post.objects.select_related('category', 'author').get(time_id=time_id) context = { 'post_data': post, } context.update(get_read_most_post()) context.update(get_exchange_link()) context.update(get_navbar_item_homepage()) handle_visited(request, time_id) return render(request, 'post/detail.html', context=context)
def center_home_view(request): context = {} context.update(get_navbar_item_homepage()) return render(request, 'datacenter/home/center_home.html', context=context)