(episode, podcast, view_name="episode", add_args=[])
return strip_tags(reverse(view_name, args=args + add_args))
Returns the link-target for an Episode, preferring slugs over Ids
Returns the link-target for an Episode, preferring slugs over Ids
Returns the link - target for an Episode preferring slugs over Ids
def get_episode_link_target(episode, podcast, view_name="episode", add_args=[]):
    """Returns the link-target for an Episode, preferring slugs over Ids"""

    # prefer slugs
    if episode.slug:
        args = [podcast.slug, episode.slug]
        view_name = "%s-slug" % view_name

    # fallback: UUIDs
    else:
        podcast = podcast or episode.podcast
        args = [podcast.id, episode.id]
        view_name = "%s-id" % view_name

    return strip_tags(reverse(view_name, args=args + add_args))
def get_episode_link_target ( episode , podcast , view_name = "episode" , add_args = [ ] ) : # prefer slugs if episode . slug : args = [ podcast . slug , episode . slug ] view_name = "%s-slug" % view_name # fallback: UUIDs else : podcast = podcast or episode . podcast args = [ podcast . id , episode . id ] view_name = "%s-id" % view_name return strip_tags ( reverse ( view_name , args = args + add_args ) )