#25448: Ease creation of custom GIS lookups
--------------------------------------+------------------------------------
Reporter: claudep | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by claudep):
Planned feature (to be tested):
{{{
#!diff
diff --git a/django/contrib/gis/db/models/lookups.py
b/django/contrib/gis/db/models/lookups.py
index 46104a2..ed993ca 100644
--- a/django/contrib/gis/db/models/lookups.py
+++ b/django/contrib/gis/db/models/lookups.py
@@ -87,13 +87,16 @@ class GISLookup(Lookup):
rhs = connection.ops.get_geom_placeholder(self.lhs.output_field,
geom, compiler)
return rhs, rhs_params
+ def get_operator(connection):
+ return connection.ops.gis_operators.get[self.lookup_name]
+
def as_sql(self, compiler, connection):
lhs_sql, sql_params = self.process_lhs(compiler, connection)
rhs_sql, rhs_params = self.process_rhs(compiler, connection)
sql_params.extend(rhs_params)
template_params = {'lhs': lhs_sql, 'rhs': rhs_sql}
- backend_op = connection.ops.gis_operators[self.lookup_name]
+ backend_op = self.get_operator(connection)
return backend_op.as_sql(connection, self, template_params,
sql_params)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25448#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.61bd2da832a511e1dced745579a91e3c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.