Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made `GeometryFieldDefinition` usable as is.

It was only missing an associated `field_class`.

Thanks to Alessandro Candini for the report.
  • Loading branch information...
commit 5895ca4dede92b1996a8c1d97dbe270fee94e3ad 1 parent a9fb7d6
@charettes authored
Showing with 13 additions and 2 deletions.
  1. +1 −0  mutant/contrib/geo/models/field.py
  2. +12 −2 mutant/contrib/geo/tests.py
View
1  mutant/contrib/geo/models/field.py
@@ -37,6 +37,7 @@ class Meta:
app_label = 'mutant'
defined_field_options = ('srid', 'spatial_index', 'dim', 'geography')
defined_field_category = _('Geometry')
+ defined_field_class = models.GeometryField
class PointFieldDefinition(GeometryFieldDefinition):
View
14 mutant/contrib/geo/tests.py
@@ -8,8 +8,9 @@
from ...test.testcases import FieldDefinitionTestMixin
from ...tests.models import BaseModelDefinitionTestCase
-from .models import (GeoModel, GeometryCollectionFieldDefinition,
- LineStringFieldDefinition, PointFieldDefinition, PolygonFieldDefinition,
+from .models import (GeoModel, GeometryFieldDefinition,
+ GeometryCollectionFieldDefinition, LineStringFieldDefinition,
+ PointFieldDefinition, PolygonFieldDefinition,
MultiLineStringFieldDefinition, MultiPointFieldDefinition,
MultiPolygonFieldDefinition)
@@ -22,6 +23,15 @@ def setUp(self):
BaseDefinition.objects.create(model_def=self.model_def, base=GeoModel)
+class GeometryFieldDefinitionTest(FieldDefinitionTestMixin,
+ GeometryFieldDefinitionBaseTest):
+ field_definition_cls = GeometryFieldDefinition
+ field_values = (
+ LineString((1, 2), (3, 4), (5, 6), (7, 8), (9, 10)),
+ Polygon( ((0.0, 0.0), (18, 50.0), (47.0, 55.0), (50.0, 0.0), (0.0, 0.0)) )
+ )
+
+
class PointFieldDefinitionTest(FieldDefinitionTestMixin,
GeometryFieldDefinitionBaseTest):
field_definition_cls = PointFieldDefinition

1 comment on commit 5895ca4

@caneta

You're welcome!

Alessandro Candini

Please sign in to comment.
Something went wrong with that request. Please try again.