Nombre de archivo único en Django

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])
Coding with Nasir