Fixed syntax error in OSMWidget

This commit is contained in:
Claude Paroz 2013-09-03 09:05:01 +02:00
parent 973502c047
commit 6ecbac21a9
2 changed files with 10 additions and 1 deletions

View File

@ -111,5 +111,5 @@ class OSMWidget(BaseGeometryWidget):
return 900913
def render(self, name, value, attrs=None):
return super(self, OSMWidget).render(name, value,
return super(OSMWidget, self).render(name, value,
{'default_lon': self.default_lon, 'default_lat': self.default_lat})

View File

@ -244,6 +244,15 @@ class SpecializedFieldTest(SimpleTestCase):
for invalid in [geom for key, geom in self.geometries.items() if key!='geometrycollection']:
self.assertFalse(GeometryForm(data={'g': invalid.wkt}).is_valid())
def test_osm_widget(self):
class PointForm(forms.Form):
p = forms.PointField(widget=forms.OSMWidget)
geom = self.geometries['point']
form = PointForm(data={'p': geom})
self.assertIn("OpenStreetMap (Mapnik)", form.as_p())
@skipUnless(HAS_GDAL and HAS_SPATIALREFSYS,
"CustomGeometryWidgetTest needs gdal support and a spatial database")
class CustomGeometryWidgetTest(SimpleTestCase):