Code

Ticket #9806: 9806.diff

File 9806.diff, 1.2 KB (added by ingenieroariel, 6 years ago)

Patch, tested in Firefox 3 on MacOSX

Line 
1diff --git a/django/contrib/gis/admin/widgets.py b/django/contrib/gis/admin/widgets.py
2index 27abc8f..fa1c468 100644
3--- a/django/contrib/gis/admin/widgets.py
4+++ b/django/contrib/gis/admin/widgets.py
5@@ -23,8 +23,7 @@ class OpenLayersWidget(Textarea):
6                 value = GEOSGeometry(value)
7             except (GEOSException, ValueError):
8                 value = None
9-
10-        if value and value.geom_type.upper() != self.geom_type:
11+        if value and value.geom_type.upper() != self.geom_type and self.geom_type != 'GEOMETRY':
12             value = None
13 
14         # Constructing the dictionary of the map options.
15diff --git a/django/contrib/gis/gdal/geomtype.py b/django/contrib/gis/gdal/geomtype.py
16index 565326f..8fedd49 100644
17--- a/django/contrib/gis/gdal/geomtype.py
18+++ b/django/contrib/gis/gdal/geomtype.py
19@@ -24,6 +24,7 @@ class OGRGeomType(object):
20         if isinstance(type_input, OGRGeomType):
21             num = type_input.num
22         elif isinstance(type_input, basestring):
23+            if type_input.lower() == 'geometry': type_input='unknown'
24             num = self._str_types.get(type_input.lower(), None)
25             if num is None:
26                 raise OGRException('Invalid OGR String Type "%s"' % type_input)