def survey_media(instance, filename):
    """Return an upload path for survey media."""
    if not instance.survey.id:
        instance.survey.save()
    return 'survey/{0}/{1}'.format(instance.survey.id, filename)