def get_context_data(self, **kwargs):
    context = super(StatsView, self).get_context_data(**kwargs)
    for slug in ['melon', 'genie', 'bugs', 'mnet']:
        context['{}_earliest'.format(slug)] = HourlySongChart.objects.filter(chart__service__slug=slug).earliest('hour').hour
    context['song_count'] = HourlySongChartEntry.objects.aggregate(song_count=Count('song', distinct=True))['song_count']
    context['artist_count'] = HourlySongChartEntry.objects.aggregate(artist_count=Count('song__artists', distinct=True))['artist_count']
    context['album_count'] = HourlySongChartEntry.objects.aggregate(album_count=Count('song__album', distinct=True))['album_count']
    return context
def get_context_data(self, **kwargs):
    context = super(StatsView, self).get_context_data(**kwargs)
    for slug in ['melon', 'genie', 'bugs', 'mnet']:
        context['{}_earliest'.format(slug)] = HourlySongChart.objects.filter(chart__service__slug=slug).earliest('hour').hour
    context['song_count'] = HourlySongChartEntry.objects.aggregate(song_count=Count('song', distinct=True))['song_count']
    context['artist_count'] = HourlySongChartEntry.objects.aggregate(artist_count=Count('song__artists', distinct=True))['artist_count']
    context['album_count'] = HourlySongChartEntry.objects.aggregate(album_count=Count('song__album', distinct=True))['album_count']
    return context