#36384: update_dimension_fields blocks getting model instances from the database
when the external storage has issues
-------------------------------------+-------------------------------------
Reporter: Gerben Morsink | Type:
| Cleanup/optimization
Status: new | Component: Database
| layer (models, ORM)
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
It seems when a height_field or width_field are given, the
update_dimension_fields is always called on initialization of the model
instance. Thereby always doing a call to an external database if those
fields are empty.
This might seem obvious, but it means that when and external storage is
down, it is not possible anymore to get this Model instance anymore.
For example with S3 issue it might raise:
```
ClientError: An error occurred (403) when calling the HeadObject
operation: Forbidden
```
even when I simply want to get the object without the width and height,
like here:
```
UserAvatar.objects.get(user=user).only('id')
```
This is in my opinion an unexpected consequence of adding the height_field
and width_field to an ImageField.
What do you think, should width and height be lazily loaded somehow?
--
Ticket URL: <https://code.djangoproject.com/ticket/36384>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/01070196c39f15d8-3bd407e6-251b-49ae-a81f-5a42418366c8-000000%40eu-central-1.amazonses.com.