3👍
✅
If there is a callable for the upload_to argument, it is called during the save() method of the model base. The save() is of course called after clean(), so you do NOT need to strip() any fields if you’ve already done so in the clean() method.
You can see where the code is called on line 90 of the Django source code: https://code.djangoproject.com/browser/django/trunk/django/db/models/fields/files.py
generate_filename
is the stored variable that points to whatever you passed into upload_to.
So, the order is form submit -> model.full_clean() -> overridden clean() -> save(), which calls upload_to()
Source:stackexchange.com