Пример #1
0
def quest(request, short_id, slug=None):
    quest = get_object_or_404(Quest, id=base36decode_or_404(short_id))

    _slug = slugify(quest.title)
    if _slug and _slug != slug:
        return redirect('quest', base36encode(quest.id), _slug)

    quest_details = quest.details()

    ctx = {
        'quest': quest_details,
        'comments': top_gallery_comments(quest, include_reactions=False),
        'quest_template_url': '',
        'original_quest_template_url': '',
    }

    if quest.reply_content_id:
        ctx.update({
            'quest_template_url':
            quest_details.content.get_absolute_url_for_image_type('gallery'),
            'original_quest_template_url':
            quest_details.content.get_absolute_url_for_image_type('original'),
        })

    return r2r_jinja('quests/quest.html', ctx, request)
Пример #2
0
def quest_top_gallery(request, quest_id, include_reactions=True):
    quest = get_object_or_404(Quest, id=quest_id)
    comments = models.top_gallery_comments(quest, viewer=request.user, include_reactions=include_reactions)

    return {
        'comments': comments,
        'quest': quest.details(),
    }
Пример #3
0
def quest_top_gallery(request, quest_id, include_reactions=True):
    quest = get_object_or_404(Quest, id=quest_id)
    comments = models.top_gallery_comments(quest,
                                           viewer=request.user,
                                           include_reactions=include_reactions)

    return {
        'comments': comments,
        'quest': quest.details(),
    }
Пример #4
0
def quest(request, short_id, slug=None):
    quest = get_object_or_404(Quest, id=base36decode_or_404(short_id))

    _slug = slugify(quest.title)
    if _slug and _slug != slug:
        return redirect('quest', base36encode(quest.id), _slug)

    quest_details = quest.details()

    ctx = {
        'quest': quest_details,
        'comments': top_gallery_comments(quest, include_reactions=False),
        'quest_template_url': '',
        'original_quest_template_url': '',
    }

    if quest.reply_content_id:
        ctx.update({
            'quest_template_url': quest_details.content.get_absolute_url_for_image_type('gallery'),
            'original_quest_template_url': quest_details.content.get_absolute_url_for_image_type('original'),
        })

    return r2r_jinja('quests/quest.html', ctx, request)