Fixed #19816 -- Pre-evaluate querysets used in direct relation assignments. #2487

Merged
merged 1 commit into from Mar 30, 2014

Conversation

Projects
None yet
2 participants
Member

loic commented Mar 27, 2014

No description provided.

@loic loic Fixed #19816 -- Pre-evaluate querysets used in direct relation assign…
…ments.

Since assignments on M2M or reverse FK descriptors is composed of a `clear()`,
followed by an `add()`, `clear()` could potentially affect the value of the
assigned queryset before the `add()` step; pre-evaluating it solves the problem.

This patch fixes the issue for ForeignRelatedObjectsDescriptor,
ManyRelatedObjectsDescriptor, and ReverseGenericRelatedObjectsDescriptor.
It completes 6cb6e1 which addressed ReverseManyRelatedObjectsDescriptor.
2039908
Member

loic commented Mar 30, 2014

@akaariai, @aaugustin, also unveiled this issue while working on the transaction patch.

I think it's RFC if one of you want to look into it.

@aaugustin aaugustin added a commit that referenced this pull request Mar 30, 2014

@aaugustin aaugustin Merge pull request #2487 from loic/ticket19816
Fixed #19816 -- Pre-evaluate querysets used in direct relation assignments.
a2407c9

@aaugustin aaugustin merged commit a2407c9 into django:master Mar 30, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment