def get_context_data(self, **kwargs): context = super(RootView, self).get_context_data(**kwargs) for i,j in ([NEWS, News.objects.all()[:3]], [ANNOUNCES, Announce.get_and_check()]): context[i] = j context[ANNOUNCES + '_count'] = range(0, len(context[ANNOUNCES])) return context
def get_context_data(self, **kwargs): context = super(AnnouncesView, self).get_context_data(**kwargs) context[ANNOUNCES] = Announce.get_and_check() return context