Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #9299 -- Made default zoom level for points in the admin more s…

…ensible. Thanks to oyvind for ticket and initial patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10635 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1269f9a3e96ed4d0913ba97b9bcc37427f560e84 1 parent 66db0b4
@jbronn jbronn authored
View
3  django/contrib/gis/admin/options.py
@@ -33,6 +33,7 @@ class GeoModelAdmin(ModelAdmin):
map_srid = 4326
map_template = 'gis/admin/openlayers.html'
openlayers_url = 'http://openlayers.org/api/2.7/OpenLayers.js'
+ point_zoom = num_zoom - 6
wms_url = 'http://labs.metacarta.com/wms/vmap0'
wms_layer = 'basic'
wms_name = 'OpenLayers WMS'
@@ -100,6 +101,7 @@ class OLMap(self.widget):
'scale_text' : self.scale_text,
'map_width' : self.map_width,
'map_height' : self.map_height,
+ 'point_zoom' : self.point_zoom,
'srid' : self.map_srid,
'display_srid' : self.display_srid,
'wms_url' : self.wms_url,
@@ -124,4 +126,5 @@ class OSMGeoAdmin(GeoModelAdmin):
map_srid = 900913
max_extent = '-20037508,-20037508,20037508,20037508'
max_resolution = 156543.0339
+ point_zoom = num_zoom - 6
units = 'm'
View
3  django/contrib/gis/templates/gis/admin/openlayers.js
@@ -127,6 +127,9 @@
}
// Zooming to the bounds.
{{ module }}.map.zoomToExtent(admin_geom.geometry.getBounds());
+ if ({{ module }}.is_point){
+ {{ module }}.map.zoomTo({{ point_zoom }});
+ }
} else {
{{ module }}.map.setCenter(new OpenLayers.LonLat({{ default_lon }}, {{ default_lat }}), {{ default_zoom }});
}
Please sign in to comment.
Something went wrong with that request. Please try again.