Friday, December 26, 2014

Re: defer() and only() chaining bug

Hi Will,

Yes and yes. I just confirmed it myself.

Collin

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?

Cheers,

Will

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5a99bc94-8360-4481-83db-c6f396b628f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment