Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Prevented rendering attrs to be squashed in OSMWidget

  • Loading branch information...
commit b6889c68d7af2e3b8efa01f7050c068afe015080 1 parent 6ecbac2
@claudep claudep authored
View
9 django/contrib/gis/forms/widgets.py
@@ -111,5 +111,10 @@ def map_srid(self):
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
2  django/contrib/gis/static/gis/js/OLMapWidget.js
@@ -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
4 django/contrib/gis/tests/test_geoforms.py
@@ -250,7 +250,9 @@ class PointForm(forms.Form):
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,
Please sign in to comment.
Something went wrong with that request. Please try again.