Commit be167b80 authored by Justin Bronn's avatar Justin Bronn
Browse files

[1.1.X] Fixed #11810 -- Fixed typo and errors that prevented `modifiable` from...

[1.1.X] Fixed #11810 -- Fixed typo and errors that prevented `modifiable` from working in the geographic admin.  Thanks to Rob Coup for the bug report.  Refs #12504.

Backport of r12995 from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12996 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent f6b6e0f1
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -111,12 +111,6 @@ class GeoModelAdmin(ModelAdmin):
                      }
        return OLMap

# Using the Beta OSM in the admin requires the following:
#  (1) The Google Maps Mercator projection needs to be added
#      to your `spatial_ref_sys` table.  You'll need at least GDAL 1.5:
#      >>> from django.contrib.gis.gdal import SpatialReference
#      >>> from django.contrib.gis.utils import add_postgis_srs
#      >>> add_postgis_srs(SpatialReference(900913)) # Adding the Google Projection 
from django.contrib.gis import gdal
if gdal.HAS_GDAL:
    class OSMGeoAdmin(GeoModelAdmin):
+22 −15
Original line number Diff line number Diff line
{# Author: Justin Bronn, Travis Pinney & Dane Springmeyer #}
{% block vars %}var {{ module }} = {};
{{ module }}.map = null; {{ module }}.controls = null; {{ module }}.panel = null; {{ module }}.re = new RegExp("^SRID=\d+;(.+)", "i"); {{ module }}.layers = {};
{{ module }}.modifiable = {{ modifiable|yesno:"true,false" }};
{{ module }}.wkt_f = new OpenLayers.Format.WKT();
{{ module }}.is_collection = {{ is_collection|yesno:"true,false" }};
{{ module }}.collection_type = '{{ collection_type }}';
@@ -88,12 +89,16 @@
  } else if ({{ module }}.is_point){
    draw_ctl = new OpenLayers.Control.DrawFeature(lyr, OpenLayers.Handler.Point, {'displayClass': 'olControlDrawFeaturePoint'});
  }
  {% if modifiable %}
  if ({{ module }}.modifiable){
    var mod = new OpenLayers.Control.ModifyFeature(lyr, {'displayClass': 'olControlModifyFeature'});
    {{ module }}.controls = [nav, draw_ctl, mod];
  {% else %}
  {{ module }}.controls = [nav, darw_ctl];
  {% endif %}  
  } else {
    if(!lyr.features.length){
      {{ module }}.controls = [nav, draw_ctl];
    } else {
      {{ module }}.controls = [nav];
    }
  }
}
{{ module }}.init = function(){
    {% block map_options %}// The options hash, w/ zoom, resolution, and projection settings.
@@ -153,7 +158,9 @@
    {% if not scrollable %}{{ module }}.map.getControlsByClass('OpenLayers.Control.Navigation')[0].disableZoomWheel();{% endif %}
    {% endblock %}
    if (wkt){
      if ({{ module }}.modifiable){
        {{ module }}.enableEditing();
      }
    } else {
      {{ module }}.enableDrawing();
    }