mirror of
https://github.com/django/django.git
synced 2025-09-02 00:37:31 +00:00
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.
This commit is contained in:
parent
03dbdfd9bb
commit
691def10a0
2 changed files with 40 additions and 0 deletions
|
@ -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]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue