(podcast, view_name="podcast", add_args=[])
return reverse(view_name, args=args + add_args)
Returns the link-target for a Podcast, preferring slugs over Ids
Returns the link-target for a Podcast, preferring slugs over Ids
Returns the link - target for a Podcast preferring slugs over Ids
def get_podcast_link_target(podcast, view_name="podcast", add_args=[]):
    """Returns the link-target for a Podcast, preferring slugs over Ids"""

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

    # as a fallback we use UUIDs
    else:
        args = [podcast.id]
        view_name = "%s-id" % view_name

    return reverse(view_name, args=args + add_args)
def get_podcast_link_target ( podcast , view_name = "podcast" , add_args = [ ] ) : # we prefer slugs if podcast . slug : args = [ podcast . slug ] view_name = "%s-slug" % view_name # as a fallback we use UUIDs else : args = [ podcast . id ] view_name = "%s-id" % view_name return reverse ( view_name , args = args + add_args )