def get(self, request): questions = Question.objects.list_hot() pagination = helpers.paginate(questions, request, key='question') return render(request, 'questions_list.html', { 'questions': pagination, 'title': 'Лучшие вопросы', 'key': 'hot', })
def questions_hot(request): questions = Question.objects.list_hot() pagination = helpers.paginate(questions, request, key='question') return render(request, 'questions_list.html', { 'questions': pagination, 'title': 'Лучшие вопросы', 'key': 'hot', })
def questions_new(request): questions = Question.objects.list_new() pagination = helpers.paginate(questions, request, key='question') return render(request, 'questions_list.html', { 'questions': pagination, 'title': 'Новые вопросы', 'key': 'new', })
def get(self, request, tag): try: tag = Tag.objects.get_by_title(tag) except Tag.DoesNotExist: raise Http404() questions = Question.objects.list_tag(tag) pagination = helpers.paginate(questions, request, key='question') return render(request, 'questions_list.html', { 'questions': pagination, 'title': u'Тег ' + tag.title, })
def questions_tag(request, tag): try: tag = Tag.objects.get_by_title(tag) except Tag.DoesNotExist: raise Http404() questions = Question.objects.list_tag(tag) pagination = helpers.paginate(questions, request, key='question') return render(request, 'questions_list.html', { 'questions': pagination, 'title': u'Тег ' + tag.title, })