File tree Expand file tree Collapse file tree 2 files changed +2
-9
lines changed
django/contrib/gis/db/models Expand file tree Collapse file tree 2 files changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -419,12 +419,6 @@ class NumPoints(GeoFunc):
419
419
output_field_class = IntegerField
420
420
arity = 1
421
421
422
- def as_sql (self , compiler , connection ):
423
- if self .source_expressions [self .geom_param_pos [0 ]].output_field .geom_type != 'LINESTRING' :
424
- if not connection .features .supports_num_points_poly :
425
- raise TypeError ('NumPoints can only operate on LineString content on this database.' )
426
- return super ().as_sql (compiler , connection )
427
-
428
422
429
423
class Perimeter (DistanceResultMixin , OracleToleranceMixin , GeoFunc ):
430
424
arity = 1
Original file line number Diff line number Diff line change @@ -336,9 +336,8 @@ def test_num_points(self):
336
336
self .assertEqual (qs .first ().num_points , 2 )
337
337
mpoly_qs = Country .objects .annotate (num_points = functions .NumPoints ('mpoly' ))
338
338
if not connection .features .supports_num_points_poly :
339
- msg = 'NumPoints can only operate on LineString content on this database.'
340
- with self .assertRaisesMessage (TypeError , msg ):
341
- list (mpoly_qs )
339
+ for c in mpoly_qs :
340
+ self .assertIsNone (c .num_points )
342
341
return
343
342
344
343
for c in mpoly_qs :
You can’t perform that action at this time.
0 commit comments