#32704: QuerySet.defer() doesn't clear deferred field when chaining with only().
-------------------------------------+-------------------------------------
Reporter: Manuel Baclet | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: defer only | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Mariusz Felisiak):
Replying to [comment:5 Manuel Baclet]:
> I think that what is described in the documentation is what users are
expected and it is the implementation that should be fixed!
I don't agree, and there is no need to shout. As documented: ''"The only()
method is more or less the opposite of defer(). You call it with the
fields that should not be deferred ..."'', so
`.only('name').defer('name')` should return all fields. You can start a
discussion on DevelopersMailingList if you don't agree.
>
> With your patch proposal, i do not think that:
> `Company.objects.only("name").defer("name").defer("country")` is
equivalent to `Company.objects.only("name").defer("name", "country")`
Did you check this? with proposed patch `country` is the only deferred
fields in both cases. As far as I'm aware that's an intended behavior.
--
Ticket URL: <https://code.djangoproject.com/ticket/32704#comment:6>
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 on the web visit
https://groups.google.com/d/msgid/django-updates/064.d09fc3da656e14a5e12e5f903c5e8564%40djangoproject.com.