Exemple #1
0
    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',
        })
Exemple #2
0
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',
            })
Exemple #3
0
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',
            })
Exemple #4
0
    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,
        })
Exemple #5
0
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,
            })