Closed joseferben closed 2 years ago
https://docs.djangoproject.com/en/4.0/ref/models/fields/#django.db.models.FileField.upload_to
if callable(self.upload_to): filename = self.upload_to(instance, filename) else: dirname = datetime.datetime.now().strftime(str(self.upload_to)) filename = posixpath.join(dirname, filename)
Actually, looking at the types it seems a little tricky. The return type seems more flexible than just str, like path and bytes also work for the calls that use the value
str
https://docs.djangoproject.com/en/4.0/ref/models/fields/#django.db.models.FileField.upload_to