codingjoe/django-stdimage

Additional query when using only()

Closed this issue · 1 comments

Hello!

I have added StdImageField to a model, simple one:

photo = StdImageField(
    verbose_name=_('image'),
    upload_to=UploadToClassNameDirUUID(),
    blank=True,
)

When I do a query on that model with only('<some_other_field>') Django will create additional query to fetch an image:
image

Is is possible to avoid that fetch? I know I could just add photo to only() but it's a workaround that would only create confusion in my code.

Hi @jmaslanka thanks for reaching out. Good catch, I didn't see this one before, but it makes sense. This certainly is a bug.