summaryrefslogtreecommitdiff
path: root/django/contrib/gis/db/models/sql/query.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/contrib/gis/db/models/sql/query.py')
-rw-r--r--django/contrib/gis/db/models/sql/query.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/django/contrib/gis/db/models/sql/query.py b/django/contrib/gis/db/models/sql/query.py
index 6995771cd6..cf1ccf6483 100644
--- a/django/contrib/gis/db/models/sql/query.py
+++ b/django/contrib/gis/db/models/sql/query.py
@@ -33,6 +33,13 @@ class GeoQuery(sql.Query):
self.transformed_srid = None
self.extra_select_fields = {}
+ if SpatialBackend.oracle:
+ # Have to override this so that GeoQuery, instead of OracleQuery,
+ # is returned when unpickling.
+ def __reduce__(self):
+ callable, args, data = super(GeoQuery, self).__reduce__()
+ return (unpickle_geoquery, (), data)
+
def clone(self, *args, **kwargs):
obj = super(GeoQuery, self).clone(*args, **kwargs)
# Customized selection dictionary and transformed srid flag have
@@ -332,3 +339,12 @@ class GeoQuery(sql.Query):
# Otherwise, check by the given field name -- which may be
# a lookup to a _related_ geographic field.
return GeoWhereNode._check_geo_field(self.model._meta, field_name)
+
+if SpatialBackend.oracle:
+ def unpickle_geoquery():
+ """
+ Utility function, called by Python's unpickling machinery, that handles
+ unpickling of GeoQuery subclasses of OracleQuery.
+ """
+ return GeoQuery.__new__(GeoQuery)
+ unpickle_geoquery.__safe_for_unpickling__ = True