Ejemplo n.º 1
0
    def get(self, request, username):

        User = get_user_model()
        user = User.objects.get(username=username)
        month_ago = datetime.today() - timedelta(days=31)
        site = RequestSite(request)

        context = {
            "page_user": user,
            "site": site.domain,
            "subscriptions_token":
            user.profile.get_token("subscriptions_token"),
            "favorite_feeds_token":
            user.profile.get_token("favorite_feeds_token"),
            "lists": self.get_podcast_lists(user),
            "subscriptions": self.get_subscriptions(user),
            "recent_episodes": last_played_episodes(user),
            "seconds_played_total": seconds_played(user),
            "seconds_played_month": seconds_played(user, month_ago),
            "favorite_episodes": FavoriteEpisode.episodes_for_user(user),
            "num_played_episodes_total": num_played_episodes(user),
            "num_played_episodes_month": num_played_episodes(user, month_ago),
        }

        return render(request, "userpage.html", context)
Ejemplo n.º 2
0
def list_favorites(request):
    user = request.user
    site = RequestSite(request)

    favorites = FavoriteEpisode.episodes_for_user(user)

    recently_listened = last_played_episodes(user)

    favfeed = FavoriteFeed(user)
    feed_url = favfeed.get_public_url(site.domain)

    podcast = Podcast.objects.filter(urls__url=feed_url).first()

    token = request.user.profile.favorite_feeds_token

    return render(
        request,
        'favorites.html',
        {
            'episodes': favorites,
            'feed_token': token,
            'site': site,
            'podcast': podcast,
            'recently_listened': recently_listened,
        },
    )
Ejemplo n.º 3
0
    def get(self, request, username):

        User = get_user_model()
        user = User.objects.get(username=username)
        month_ago = datetime.today() - timedelta(days=31)
        site = RequestSite(request)

        context = {
            'page_user': user,
            'flattr_username':
            user.profile.settings.get_wksetting(FLATTR_USERNAME),
            'site': site.domain,
            'subscriptions_token':
            user.profile.get_token('subscriptions_token'),
            'favorite_feeds_token':
            user.profile.get_token('favorite_feeds_token'),
            'lists': self.get_podcast_lists(user),
            'subscriptions': self.get_subscriptions(user),
            'recent_episodes': last_played_episodes(user),
            'seconds_played_total': seconds_played(user),
            'seconds_played_month': seconds_played(user, month_ago),
            'favorite_episodes': FavoriteEpisode.episodes_for_user(user),
            'num_played_episodes_total': num_played_episodes(user),
            'num_played_episodes_month': num_played_episodes(user, month_ago),
        }

        return render(request, 'userpage.html', context)
Ejemplo n.º 4
0
def list_favorites(request):
    user = request.user
    site = RequestSite(request)

    favorites = FavoriteEpisode.episodes_for_user(user)

    recently_listened = last_played_episodes(user)

    favfeed = FavoriteFeed(user)
    feed_url = favfeed.get_public_url(site.domain)

    podcast = Podcast.objects.filter(urls__url=feed_url).first()

    token = request.user.profile.favorite_feeds_token

    return render(
        request,
        "favorites.html",
        {
            "episodes": favorites,
            "feed_token": token,
            "site": site,
            "podcast": podcast,
            "recently_listened": recently_listened,
        },
    )
Ejemplo n.º 5
0
def list_favorites(request):
    user = request.user
    site = RequestSite(request)

    favorites = FavoriteEpisode.episodes_for_user(user)

    recently_listened = last_played_episodes(user)

    favfeed = FavoriteFeed(user)
    feed_url = favfeed.get_public_url(site.domain)

    podcast = Podcast.objects.filter(urls__url=feed_url).first()

    token = request.user.profile.favorite_feeds_token

    return render(
        request,
        'favorites.html',
        {
            'episodes': favorites,
            'feed_token': token,
            'site': site,
            'podcast': podcast,
            'recently_listened': recently_listened,
        },
    )
Ejemplo n.º 6
0
    def get(self, request, username):

        User = get_user_model()
        user = User.objects.get(username=username)
        month_ago = datetime.today() - timedelta(days=31)
        site = RequestSite(request)

        context = {
            'page_user': user,
            'site': site.domain,
            'subscriptions_token': user.profile.get_token('subscriptions_token'),
            'favorite_feeds_token': user.profile.get_token('favorite_feeds_token'),
            'lists': self.get_podcast_lists(user),
            'subscriptions': self.get_subscriptions(user),
            'recent_episodes': last_played_episodes(user),
            'seconds_played_total': seconds_played(user),
            'seconds_played_month': seconds_played(user, month_ago),
            'favorite_episodes': FavoriteEpisode.episodes_for_user(user),
            'num_played_episodes_total': num_played_episodes(user),
            'num_played_episodes_month': num_played_episodes(user, month_ago),
        }

        return render(request, 'userpage.html', context)