1👍
✅
You can access the instance
field that contains an instance of UploadFile
and you can read the contents:
import hashlib
def get_upload_file_name(instance, filename):
return hashlib.sha1(instance.field.read()).hexdigest()
Source:stackexchange.com