summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorMatt Westcott <matt@west.co.tt>2023-01-20 18:10:29 +0000
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-01-23 11:14:57 +0100
commitb332a96cd721defb6ff13ba1bc57958a984f0773 (patch)
tree102418113464c73d576b4684c9cc44e9a189a514 /django
parent0fd5d16c222583dd68128b70b17e461d4decda8c (diff)
[4.2.x] Fixed #34192 -- Preserved callable storage when it returns default_storage.
Backport of ef85b6bf0bc5a8b194f0724cf5bbedbcee402b96 from main
Diffstat (limited to 'django')
-rw-r--r--django/db/models/fields/files.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py
index 7a99b12691..04b3eb3473 100644
--- a/django/db/models/fields/files.py
+++ b/django/db/models/fields/files.py
@@ -295,8 +295,9 @@ class FileField(Field):
if kwargs.get("max_length") == 100:
del kwargs["max_length"]
kwargs["upload_to"] = self.upload_to
- if self.storage is not default_storage:
- kwargs["storage"] = getattr(self, "_storage_callable", self.storage)
+ storage = getattr(self, "_storage_callable", self.storage)
+ if storage is not default_storage:
+ kwargs["storage"] = storage
return name, path, args, kwargs
def get_internal_type(self):