示例#1
0
def determine_media_upload_path(instance, filename):
    if instance.is_video():
        fmt = "videos/projects/%(partition)d/%(filename)s"
    else:
        fmt = "images/projects/%(partition)d/%(filename)s"
    return fmt % {
        'partition': get_partition_id(instance.project.pk),
        'filename': safe_filename(filename),
    }
示例#2
0
文件: models.py 项目: walkah/batucada
def determine_media_upload_path(instance, filename):
    if instance.is_video():
        fmt = "videos/projects/%(partition)d/%(filename)s"
    else:
        fmt = "images/projects/%(partition)d/%(filename)s"
    return fmt % {
        'partition': get_partition_id(instance.project.pk),
        'filename': safe_filename(filename),
    }
示例#3
0
def determine_upload_path(instance, filename):
    chunk_size = 1000  # max files per directory
    return "images/badges/%(partition)d/%(filename)s" % {
        'partition': get_partition_id(instance.pk, chunk_size),
        'filename': safe_filename(filename),
    }
示例#4
0
def determine_image_upload_path(instance, filename):
    return "images/projects/%(partition)d/%(filename)s" % {
        'partition': get_partition_id(instance.pk),
        'filename': safe_filename(filename),
    }
示例#5
0
def determine_image_upload_path(instance, filename):
    return "images/projects/%(partition)d/%(filename)s" % {
        'partition': get_partition_id(instance.pk),
        'filename': safe_filename(filename),
    }
示例#6
0
文件: models.py 项目: mkcode/lernanta
def determine_upload_path(instance, filename):
    chunk_size = 1000  # max files per directory
    return "images/profiles/%(partition)d/%(filename)s" % {
        'partition': get_partition_id(instance.pk, chunk_size),
        'filename': safe_filename(filename),
    }