Beispiel #1
0
def welcome(request):
    current_site = RequestSite(request)

    podcasts = get_cache_or_calc('podcast-count', timeout=60*60,
                    calc=lambda: Podcast.count())
    users    = get_cache_or_calc('user-count', timeout=60*60,
                    calc=lambda: User.count())
    episodes = get_cache_or_calc('episode-count', timeout=60*60,
                    calc=lambda: Episode.count())

    lang = utils.process_lang_params(request)

    toplist = PodcastToplist(lang)

    return render(request, 'home.html', {
          'podcast_count': podcasts,
          'user_count': users,
          'episode_count': episodes,
          'url': current_site,
          'toplist': toplist,
    })
Beispiel #2
0
 def _get_stats(self):
     return {
         'podcasts': podcast_count(),
         'episodes': episode_count(),
         'users': User.count(),
     }