Friday, December 26, 2014

Re: defer() and only() chaining bug

Hi Will,

Yes and yes. I just confirmed it myself.


On Tuesday, December 23, 2014 5:45:00 AM UTC-6, William Earp wrote:
Hi all,

I'm currently writing unit tests for defer() and only() under issue #18586. But there appears to a bug when it comes to chaining the two together.

The docs gives the following example for only():

# Final result loads headline and body immediately (only() replaces any existing set of fields).

Entry.objects.defer("body").only("headline", "body")

It turns out that "body" remains a DeferredAttribute when it shouldn't. So in the example above, if the model contained just the two fields "headline" and "body" there wouldn't be any deferred field. In my tests "body" is still a DeferredAttribute.

Am I getting this right or is this actually a bug?



You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment