mirror of
https://github.com/django/django.git
synced 2025-08-02 18:13:02 +00:00
Fixed #22023 -- Raised an error for values() followed by defer() or only().
Previously, doing so resulted in invalid data or crash. Thanks jtiai for the report and Karol Jochelson, Jakub Nowak, Loic Bistuer, and Baptiste Mispelon for reviews.
This commit is contained in:
parent
a7639722f5
commit
faf6a911ad
4 changed files with 34 additions and 3 deletions
|
@ -1060,6 +1060,12 @@ class ValuesQuerySet(QuerySet):
|
|||
# QuerySet.clone() will also set up the _fields attribute with the
|
||||
# names of the model fields to select.
|
||||
|
||||
def only(self, *fields):
|
||||
raise NotImplementedError("ValuesQuerySet does not implement only()")
|
||||
|
||||
def defer(self, *fields):
|
||||
raise NotImplementedError("ValuesQuerySet does not implement defer()")
|
||||
|
||||
def iterator(self):
|
||||
# Purge any extra columns that haven't been explicitly asked for
|
||||
extra_names = list(self.query.extra_select)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue