def get_media(post): if post.image: media = "{0}{1}".format(settings.DOMAIN, post.image) else: media = None return media