Beispiel #1
0
def get_portfolio_carousels():
    portfolios = cache.get("portfolio_carousels")
    if not portfolios:
        portfolios = Portfolio.get_latest(max_size=3)
        # if len(testimonials) > 3:
        #     testimonials = testimonials[0:3]
        # cache.set("portfolio_carousels", testimonials)

    return portfolios
Beispiel #2
0
def home(request):
    if request.user:
        most_rated_products = Rate.get_most_rated_products(max_size=4)
        most_hot_products = Product.get_hot(max_size=4)
        recent_portfolios = Portfolio.get_latest(max_size=4)
        recent_articles = Article.get_recommended()
        activities = Activity.get_banner_activity()
        types = ProductType.objects.all()

        return render(request, "welcome.html", {"most_rated_products": most_rated_products,
                        "recent_articles": recent_articles, "types": types, 'activities': activities,  "recent_portfolios": recent_portfolios, "most_hot_products": most_hot_products})
    else:
        return render(request, "home.html")