1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #34192 -- Preserved callable storage when it returns default_storage.

This commit is contained in:
Matt Westcott
2023-01-20 18:10:29 +00:00
committed by Mariusz Felisiak
parent e3a4cee081
commit ef85b6bf0b
3 changed files with 27 additions and 4 deletions

View File

@@ -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):