diff options
| author | Artur Frysiak <artur@frysiak.net> | 2014-02-15 22:44:14 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-02-17 14:46:13 -0500 |
| commit | faf6a911ad7357c8dd1defa3be0317a8418febf7 (patch) | |
| tree | 75ebbb6b93ea6d574185472bc1d7bf82df053a7e /django | |
| parent | a7639722f57eebc71cd396512e1fe5c86bebbf15 (diff) | |
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.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/query.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py index 725c04caca..4d258ff60d 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -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) |
