from games.models import Game
def most_popular_games(request):
return { "MOST_POPULAR_GAMES": Game.objects.filter(active=True).order_by("-rating", "-id")[:5] }
TEMPLATE_CONTEXT_PROCESSORS = (
...
"download_games.context_processors.most_popular_games",
...
}
{% for game in MOST_POPULAR_GAMES %}
...
{% endfor %}