Prevented rendering attrs to be squashed in OSMWidget

This commit is contained in:
Claude Paroz 2013-09-03 10:01:13 +02:00
parent 6ecbac21a9
commit b6889c68d7
3 changed files with 11 additions and 4 deletions

View File

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

View File

@ -213,7 +213,7 @@ function MapWidget(options) {
var styleMap = new OpenLayers.StyleMap({'default': OpenLayers.Util.applyDefaults(defaults_style, OpenLayers.Feature.Vector.style['default'])});
this.layers.vector = new OpenLayers.Layer.Vector(" " + this.options.name, {styleMap: styleMap});
this.map.addLayer(this.layers.vector);
wkt = document.getElementById(this.options.id).value;
var wkt = document.getElementById(this.options.id).value;
if (wkt) {
var feat = OpenLayers.Util.properFeatures(this.read_wkt(wkt), this.options.geom_type);
this.write_wkt(feat);

View File

@ -250,7 +250,9 @@ class SpecializedFieldTest(SimpleTestCase):
geom = self.geometries['point']
form = PointForm(data={'p': geom})
self.assertIn("OpenStreetMap (Mapnik)", form.as_p())
rendered = form.as_p()
self.assertIn("OpenStreetMap (Mapnik)", rendered)
self.assertIn("id: 'id_p',", rendered)
@skipUnless(HAS_GDAL and HAS_SPATIALREFSYS,