Пример #1
0
def detail(request, addon):
    """Theme details page."""
    theme = addon.persona

    categories = [category for category in addon.all_categories if
                  category.application.id == amo.FIREFOX.id]
    if categories:
        qs = Addon.objects.public().filter(categories=categories[0])
        category_themes = _category_themes(qs, limit=6)
    else:
        category_themes = None

    reviews = Review.objects.valid().filter(addon=addon, is_latest=True)

    data = {
        'product': addon,
        'reviews': reviews[:2],
        'flags': get_flags(request, reviews),
        'has_review': request.user.is_authenticated() and
                      reviews.filter(user=request.user.id).exists(),
        'categories': categories,
        'category_themes': category_themes,
        'author_themes': theme.authors_other_addons(request.APP)[:3],
        'theme': theme,
    }
    if not theme.is_new():
        # Remora uses persona.author despite there being a display_username.
        data['author_gallery'] = settings.PERSONAS_USER_ROOT % theme.author

    return jingo.render(request, 'themes/detail.html', data)
Пример #2
0
def detail(request, addon):
    """Theme details page."""
    theme = addon.persona

    categories = [category for category in addon.all_categories if
                  category.application.id == amo.FIREFOX.id]
    if categories:
        qs = Addon.objects.public().filter(categories=categories[0])
        category_themes = _category_themes(qs, limit=6)
    else:
        category_themes = None

    reviews = Review.objects.latest().filter(addon=addon)

    data = {
        'product': addon,
        'reviews': reviews[:2],
        'flags': get_flags(request, reviews),
        'has_review': request.user.is_authenticated() and
                      reviews.filter(user=request.user.id).exists(),
        'categories': categories,
        'category_themes': category_themes,
        'author_themes': theme.authors_other_addons(request.APP)[:3],
        'theme': theme,
    }
    if not theme.is_new():
        # Remora uses persona.author despite there being a display_username.
        data['author_gallery'] = settings.PERSONAS_USER_ROOT % theme.author

    return jingo.render(request, 'themes/detail.html', data)
Пример #3
0
def detail(request, addon):
    """Theme details page."""
    theme = addon.persona

    categories = addon.all_categories
    if categories:
        qs = Addon.objects.public().filter(categories=categories[0])
        category_themes = _category_themes(qs, limit=6)
    else:
        category_themes = None

    data = {
        'product': addon,
        'categories': categories,
        'category_themes': category_themes,
        'author_themes': theme.authors_other_addons(request.APP)[:3],
        'theme': theme,
    }
    if not theme.is_new():
        # Remora uses persona.author despite there being a display_username.
        data['author_gallery'] = settings.PERSONAS_USER_ROOT % theme.author

    return jingo.render(request, 'themes/detail.html', data)
Пример #4
0
def detail(request, addon):
    """Theme details page."""
    theme = addon.persona

    categories = addon.all_categories
    if categories:
        qs = Addon.objects.public().filter(categories=categories[0])
        category_themes = _category_themes(qs, limit=6)
    else:
        category_themes = None

    data = {
        'product': addon,
        'categories': categories,
        'category_themes': category_themes,
        'author_themes': theme.authors_other_addons(request.APP)[:3],
        'theme': theme,
    }
    if not theme.is_new():
        # Remora uses persona.author despite there being a display_username.
        data['author_gallery'] = settings.PERSONAS_USER_ROOT % theme.author

    return jingo.render(request, 'themes/detail.html', data)