(request, podcast)
return render(
        request,
        "podcast.html",
        {
            "tags": tags,
            "has_tagged": has_tagged,
            "url": current_site,
            "has_history": has_history,
            "podcast": podcast,
            "devices": subscribed_devices,
            "related_podcasts": rel_podcasts,
            "can_subscribe": len(subscribe_targets) > 0,
            "subscribe_targets": subscribe_targets,
            "episode": episode,
            "episodes": episodes,
            "max_listeners": max_listeners,
            "is_publisher": is_publisher,
            "page_list": page_list,
            "current_page": 1,
        },
    )
Shows a podcast detail page
Shows a podcast detail page
Shows a podcast detail page
def show(request, podcast):
    """Shows a podcast detail page"""

    podcast = check_restrictions(podcast)

    current_site = RequestSite(request)
    num_episodes = 20
    episodes = episode_list(podcast, request.user, limit=num_episodes)
    user = request.user

    # TODO: move into EpisodeList (?) class
    listeners = [e.listeners for e in episodes if e.listeners is not None]
    max_listeners = max(listeners, default=0)

    episode = None

    if episodes:
        episode = episodes[0]
        episodes = episodes[1:]

    if podcast.group:
        group = podcast.group
        rel_podcasts = group.podcast_set.all()
    else:
        rel_podcasts = []

    tags = get_tags(podcast, user)
    has_tagged = any(t["is_own"] for t in tags)

    if user.is_authenticated:
        subscribed_devices = Client.objects.filter(
            subscription__user=user, subscription__podcast=podcast
        )

        subscribe_targets = get_subscribe_targets(podcast, user)

        has_history = HistoryEntry.objects.filter(user=user, podcast=podcast).exists()

    else:
        has_history = False
        subscribed_devices = []
        subscribe_targets = []

    is_publisher = check_publisher_permission(user, podcast)

    episodes_total = podcast.episode_count or 0
    num_pages = episodes_total / num_episodes
    page_list = get_page_list(1, num_pages, 1, 15)

    return render(
        request,
        "podcast.html",
        {
            "tags": tags,
            "has_tagged": has_tagged,
            "url": current_site,
            "has_history": has_history,
            "podcast": podcast,
            "devices": subscribed_devices,
            "related_podcasts": rel_podcasts,
            "can_subscribe": len(subscribe_targets) > 0,
            "subscribe_targets": subscribe_targets,
            "episode": episode,
            "episodes": episodes,
            "max_listeners": max_listeners,
            "is_publisher": is_publisher,
            "page_list": page_list,
            "current_page": 1,
        },
    )
def show ( request , podcast ) : podcast = check_restrictions ( podcast ) current_site = RequestSite ( request ) num_episodes = 20 episodes = episode_list ( podcast , request . user , limit = num_episodes ) user = request . user # TODO: move into EpisodeList (?) class listeners = [ e . listeners for e in episodes if e . listeners is not None ] max_listeners = max ( listeners , default = 0 ) episode = None if episodes : episode = episodes [ 0 ] episodes = episodes [ 1 : ] if podcast . group : group = podcast . group rel_podcasts = group . podcast_set . all ( ) else : rel_podcasts = [ ] tags = get_tags ( podcast , user ) has_tagged = any ( t [ "is_own" ] for t in tags ) if user . is_authenticated : subscribed_devices = Client . objects . filter ( subscription__user = user , subscription__podcast = podcast ) subscribe_targets = get_subscribe_targets ( podcast , user ) has_history = HistoryEntry . objects . filter ( user = user , podcast = podcast ) . exists ( ) else : has_history = False subscribed_devices = [ ] subscribe_targets = [ ] is_publisher = check_publisher_permission ( user , podcast ) episodes_total = podcast . episode_count or 0 num_pages = episodes_total / num_episodes page_list = get_page_list ( 1 , num_pages , 1 , 15 ) return render ( request , "podcast.html" , { "tags" : tags , "has_tagged" : has_tagged , "url" : current_site , "has_history" : has_history , "podcast" : podcast , "devices" : subscribed_devices , "related_podcasts" : rel_podcasts , "can_subscribe" : len ( subscribe_targets ) > 0 , "subscribe_targets" : subscribe_targets , "episode" : episode , "episodes" : episodes , "max_listeners" : max_listeners , "is_publisher" : is_publisher , "page_list" : page_list , "current_page" : 1 , } , )