summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAndriy Sokolovskiy <me@asokolovskiy.com>2015-05-29 14:45:36 +0300
committerTim Graham <timograham@gmail.com>2015-06-02 09:54:53 -0400
commit2913d6b77d8b2082dc79df5503b7dd3ddd05fcc1 (patch)
treed398a8d601c48e8b1891fb8542f9a6b5999f596e /django
parente1e6399c2ce39a3656155c4d704340eac83926a7 (diff)
Fixed #24831 -- Fixed pickling queryset with prefetch_related() after deleting objects.
Diffstat (limited to 'django')
-rw-r--r--django/db/models/fields/related.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index 15d032dc1f..a3183b331f 100644
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
@@ -1471,6 +1471,11 @@ class ManyToOneRel(ForeignObjectRel):
self.field_name = field_name
+ def __getstate__(self):
+ state = self.__dict__.copy()
+ state.pop('related_model', None)
+ return state
+
def get_related_field(self):
"""
Return the Field in the 'to' object to which this relationship is tied.