Example #1
0
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     context['carousel_items'] = CarouselItem.objects.filter(archived=False)
     context['events'] = get_events_for(self.request.user)
     context['posts'] = (Post.items_visible_to(self.request.user)
                         .order_by('-pub_date')[:SiteIndex.POST_COUNT])
     context['songs'] = (Song.items_visible_to(self.request.user)
                         .order_by('-pub_date')[:SiteIndex.SONG_COUNT])
     context['annotation'] = (SongNote.items_visible_to(self.request.user)
                              .order_by('-pub_date').first())
     context['annotations'] = (
         SongNote.items_visible_to(self.request.user)
         .order_by('-pub_date')[:SiteIndex.ANNOTATION_COUNT])
     return context
Example #2
0
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     context['article'] = (Article.items_visible_to(self.request.user)
                           .order_by('-pub_date').first())
     context['events'] = get_events_for(self.request.user)
     context['posts'] = (Post.items_visible_to(self.request.user)
                         .order_by('-pub_date')[:SiteIndex.POST_COUNT])
     context['songs'] = (Song.items_visible_to(self.request.user)
                         .order_by('-pub_date')[:SiteIndex.SONG_COUNT])
     context['song_of_the_day'] = self.get_song_of_the_day()
     context['annotation'] = (SongNote.items_visible_to(self.request.user)
                              .order_by('-pub_date').first())
     song_notes = SongNote.items_visible_to(self.request.user).order_by(
         '-pub_date')[:SiteIndex.ANNOTATION_COUNT]
     artist_notes = ArtistNote.items_visible_to(self.request.user).order_by(
         '-pub_date')[:SiteIndex.ANNOTATION_COUNT]
     notes = (list(song_notes) + list(artist_notes))
     notes.sort(key=lambda x: x.pub_date, reverse=True)
     context['annotations'] = notes[:SiteIndex.ANNOTATION_COUNT]
     return context
Example #3
0
 def get_context_data(self, **kwargs):
     context = super().get_context_data(**kwargs)
     context['events'] = get_events_for(self.request.user)
     context['performers'] = Performer.objects.filter(
         fb_page_id__isnull=False).exclude(fb_page_id='')
     return context