📅  最后修改于: 2022-03-11 14:47:01.154000             🧑  作者: Mango
from django.contrib.auth.models import User
def create_filepath(directory, instance, filename):
new_filename = "%s.%s" % (User.objects.make_random_password(10),filename.split('.')[-1])
return '/'.join([directory, new_filename])