diff options
| author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2016-12-16 08:36:16 +0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-12-16 10:34:02 -0500 |
| commit | 5d28fef8f9329e440ee67cefc900dbf89f4c524c (patch) | |
| tree | 8878b3cd4337f462a597f247f20f8a3fdb69e606 /django | |
| parent | 3215bc98fe934f21f37fc5cc38ae5f123f444140 (diff) | |
Made NumPoints raise TypeError on MySQL when it's used on fields besides LineStringField.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/gis/db/models/functions.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/django/contrib/gis/db/models/functions.py b/django/contrib/gis/db/models/functions.py index 06b44e7b9f..8a4d54aac1 100644 --- a/django/contrib/gis/db/models/functions.py +++ b/django/contrib/gis/db/models/functions.py @@ -382,9 +382,10 @@ class NumPoints(GeoFunc): output_field_class = IntegerField arity = 1 - def as_sqlite(self, compiler, connection): + def as_sql(self, compiler, connection): if self.source_expressions[self.geom_param_pos].output_field.geom_type != 'LINESTRING': - raise TypeError("SpatiaLite NumPoints can only operate on LineString content") + if not connection.features.supports_num_points_poly: + raise TypeError('NumPoints can only operate on LineString content on this database.') return super(NumPoints, self).as_sql(compiler, connection) |
