﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
21021	"Default geom_type attribute for GeometryWidget should be ""Geometry"", not ""Unknown"""	Mathieu Leplatre	Giannis Adamopoulos	"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.
https://github.com/django/django/blob/1.6b2/django/contrib/gis/forms/fields.py#L42



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.

"	Cleanup/optimization	closed	GIS	1.6-beta-1	Normal	fixed	minor	Claude Paroz olivier.tabone@…	Ready for checkin	1	0	0	0	0	0
