Answers for "Unique file name in django"

0

Unique file name in 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])
Posted by: Guest on August-24-2021

Python Answers by Framework

Browse Popular Code Answers by Language