Ejemplo n.º 1
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")
Ejemplo n.º 2
0
def get_banner_activities():
    banner_activities = cache.get("banner_activities")
    if not banner_activities:
        banner_activities = Activity.get_banner_activity()
        # cache.set("pop_articles", articles)
    return banner_activities