def global_variables(request): return { 'hot_nodes': Node.hot(), 'hot_topics': Topic.hot(), 'hot_users': User.hot(), 'latest_topics': Topic.objects.order_by('-id')[:10], 'central_banks': CentralBank.objects.all(), }
def get_context_data(self, **kwargs): ctx = { 'hot_topics': Topic.hot(), 'hot_nodes': Node.hot(), 'total_users': User.objects.count(), 'total_topics': User.objects.count(), 'total_nodes': Node.objects.count(), 'total_replies': Reply.objects.count(), 'planes': Plane.objects.all(), 'tab': 'forum', } return ctx
def index(request): hot_topics = Topic.hot() new_topics = Topic.objects.order_by('-id')[:10] recent_blogs = Blog.recent(5) stick_blogs = Blog.sticks() hot_blogs = Blog.hot(2) hot_nodes = Node.hot() return render(request, 'common/index.html', { 'hot': hot_topics, 'new': new_topics, 'recent_blogs': recent_blogs, 'hot_blogs': hot_blogs, 'sticks': stick_blogs, 'hot_nodes': hot_nodes, 'recent_events': EconomicEvent.objects.order_by('-time')[:10], 'tab': 'index', })