Default geom_type attribute for GeometryWidget should be "Geometry", not "Unknown"
|Reported by:||leplatrem||Owned by:||EricBoersma|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
The default value for geom_type is "Unknown" whereas we expect it to be "Geometry".
Indeed, by default we rely on GDAL to set the geom_type attribute, and it returns an unexpected value :
>>> from django.contrib.gis import gdal >>> str(gdal.OGRGeomType('GEOMETRY')) 'Unknown'
In fields, we override explicitly his value, so the problem is hidden.
But IMHO the widget should behave nicely with default values, for example instantiated like this :
class BigMapWidget(BaseGeometryWidget): map_height = 1200 class GeomForm(forms.Form): def __init__(self, *args, **kwargs): super(GeomForm, self).__init__(*args, **kwargs) self.fields['geom'].widget = BigMapWidget()
Of course, this problem only applies to generic Geometry field types, and those are commonly used.
Change History (5)
comment:1 Changed 2 years ago by claudep
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
comment:2 Changed 2 years ago by EricBoersma
- Owner changed from nobody to EricBoersma
- Status changed from new to assigned
comment:3 Changed 23 months ago by timo
- Has patch set
- Triage Stage changed from Accepted to Ready for checkin