--
Ticket URL: <https://code.djangoproject.com/ticket/30843>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => wontfix
* component: Uncategorized => Database layer (models, ORM)
Comment:
Thanks for this report, however this looks like sth that should be fixed
in `django-storages`. I don't see many use cases for this feature. You can
always add a `@cached_property` to your model to avoid multiple calls of
`FileField.size`, e.g.
{{{
@cached_property
def file_size(self):
return self.file.size
}}}
You can also create a custom field:
{{{
class MyFileField(FileField):
@cached_property
def custom_size_attribute(self):
return self.size
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30843#comment:1>