diff options
| author | Andrew Brown <brownan@gmail.com> | 2019-08-27 12:58:11 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-08-27 13:05:20 +0200 |
| commit | 691def10a0197d83d2d108bd9043b0916d0f09b4 (patch) | |
| tree | 44d4c239fc2d887b9cd58eb9b8fccba09ed76171 /django | |
| parent | 03dbdfd9bbbbd0b0172aad648c6bbe3f39541137 (diff) | |
Fixed #30727 -- Made Subquery pickle without evaluating their QuerySet.
Subquery expression objects, when pickled, were evaluating the QuerySet
objects saved in its _constructor_args attribute.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/expressions.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py index 5f85b47423..1dd061c152 100644 --- a/django/db/models/expressions.py +++ b/django/db/models/expressions.py @@ -1019,6 +1019,11 @@ class Subquery(Expression): self.extra = extra super().__init__(output_field) + def __getstate__(self): + state = super().__getstate__() + state.pop('_constructor_args', None) + return state + def get_source_expressions(self): return [self.query] |
