Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.5.x] Fix #19524 -- Incorrect caching of parents of unsaved model i…
- Loading branch information
Showing
5 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -692,7 +692,10 @@ def __init__(self, data=None, files=None, instance=None, | |
self.rel_name = RelatedObject(self.fk.rel.to, self.model, self.fk).get_accessor_name() | ||
if queryset is None: | ||
queryset = self.model._default_manager | ||
qs = queryset.filter(**{self.fk.name: self.instance}) | ||
if self.instance.pk: | ||
qs = queryset.filter(**{self.fk.name: self.instance}) | ||
else: | ||
qs = queryset.none() | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
aaugustin
Author
Member
|
||
super(BaseInlineFormSet, self).__init__(data, files, prefix=prefix, | ||
queryset=qs, **kwargs) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This introduce a regression with related managers on 1.5.X since
none
returns anEmptyQuerySet
instance while it works fine onmaster
sincenone
sets the underlying query to empty while returning aqueryset.__class__
instance. I'll open a ticket with a failing test case.