Skip to content

Commit

Permalink
fixup! Fixed #28184 -- Allowed using callable as FileField and ImageF…
Browse files Browse the repository at this point in the history
…ield storage.
  • Loading branch information
carltongibson committed Apr 2, 2020
1 parent e74c9d0 commit 5fdc997
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions docs/topics/files.txt
Expand Up @@ -230,17 +230,3 @@ For example::

class MyModel(models.Model):
my_file = models.FileField(storage=select_storage)

A ``Storage`` subclass implementing ``__call__()`` to return ``self`` may use
this to feature to perform customization::

class CustomStorage(Storage):
# Adding a call method makes the instance callable.
def __call__(self):
if os.getenv('IS_PRODUCTION', False):
self.location = '/overridden/path/'
return self


class MyModel(models.Model):
my_file = models.FileField(storage=CustomStorage())

0 comments on commit 5fdc997

Please sign in to comment.