diff --git a/django/contrib/gis/templates/gis/admin/openlayers.js b/django/contrib/gis/templates/gis/admin/openlayers.js
index 4425fee..232c8c7 100644
--- a/django/contrib/gis/templates/gis/admin/openlayers.js
+++ b/django/contrib/gis/templates/gis/admin/openlayers.js
@@ -1,7 +1,11 @@
 {% load l10n %}
 OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:3857", OpenLayers.Layer.SphericalMercator.projectForward);
 {% block vars %}var {{ module }} = {};
-{{ module }}.map = null; {{ module }}.controls = null; {{ module }}.panel = null; {{ module }}.re = new RegExp("^SRID=\\d+;(.+)", "i"); {{ module }}.layers = {};
+{{ 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" }};
@@ -11,8 +15,23 @@ OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:3857", OpenLayers.Layer.Sp
 {{ module }}.is_polygon = {{ is_polygon|yesno:"true,false" }};
 {{ module }}.is_point = {{ is_point|yesno:"true,false" }};
 {% endblock %}
+// Patch for http://trac.osgeo.org/openlayers/ticket/2240
 {{ module }}.get_ewkt = function(feat){
-  return 'SRID={{ srid|unlocalize }};' + {{ module }}.wkt_f.write(feat);
+  if (feat.constructor == Array) {
+    wkts = [];
+    for(var i = 0; i < feat.length; i++){
+      wkts.push(feat[i].geometry.toString());
+    }
+    return 'SRID={{ srid|unlocalize }};GEOMETRYCOLLECTION(' + wkts.join(', ') + ')';
+  } else if (feat.geometry.CLASS_NAME == 'OpenLayers.Geometry.Collection') {
+    wkts = [];
+    for (var i=0; i < feat.geometry.components.length; i++){
+      wkts.push(feat.geometry.components[i].toString());
+    }
+    return 'SRID={{ srid|unlocalize }};GEOMETRYCOLLECTION(' + wkts.join(', ') + ')';
+  } else {
+    return 'SRID={{ srid|unlocalize }};' + {{ module }}.wkt_f.write(feat);
+  }
 };
 {{ module }}.read_wkt = function(wkt){
   // OpenLayers cannot handle EWKT -- we make sure to strip it out.
@@ -22,8 +41,15 @@ OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:3857", OpenLayers.Layer.Sp
   return {{ module }}.wkt_f.read(wkt);
 };
 {{ module }}.write_wkt = function(feat){
-  if ({{ module }}.is_collection){ {{ module }}.num_geom = feat.geometry.components.length;}
-  else { {{ module }}.num_geom = 1;}
+  if ({{ module }}.is_collection){
+    if (feat.constructor == Array) {
+      {{ module }}.num_geom = feat.length;
+    } else {
+      {{ module }}.num_geom = feat.geometry.components.length;
+    }
+  } else {
+    {{ module }}.num_geom = 1;
+  }
   document.getElementById('{{ id }}').value = {{ module }}.get_ewkt(feat);
 };
 {{ module }}.add_wkt = function(event){
@@ -53,7 +79,11 @@ OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:3857", OpenLayers.Layer.Sp
     } else {
       // When modifying the selected components are added to the
       // vector layer so we only increment to the `num_geom` value.
-      var feat = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.{{ geom_type }}());
+      if ({{ module }}.collection_type == 'Any') {
+        var feat = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Collection());
+      } else {
+        var feat = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.{{ geom_type }}());
+      }
       for (var i = 0; i < {{ module }}.num_geom; i++){
         feat.geometry.addComponents([{{ module }}.layers.vector.features[i].geometry]);
       }
@@ -92,13 +122,13 @@ OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:3857", OpenLayers.Layer.Sp
   {{ module }}.panel = new OpenLayers.Control.Panel({'displayClass': 'olControlEditingToolbar'});
   {{ module }}.controls = [new OpenLayers.Control.Navigation()];
   if (!{{ module }}.modifiable && lyr.features.length) return;
-  if ({{ module }}.is_linestring || {{ module }}.is_generic){
+  if ({{ module }}.is_linestring || {{ module }}.is_generic || {{ module }}.is_collection){
     {{ module }}.controls.push(new OpenLayers.Control.DrawFeature(lyr, OpenLayers.Handler.Path, {'displayClass': 'olControlDrawFeaturePath'}));
   }
-  if ({{ module }}.is_polygon || {{ module }}.is_generic){
+  if ({{ module }}.is_polygon || {{ module }}.is_generic || {{ module }}.is_collection){
     {{ module }}.controls.push(new OpenLayers.Control.DrawFeature(lyr, OpenLayers.Handler.Polygon, {'displayClass': 'olControlDrawFeaturePolygon'}));
   }
-  if ({{ module }}.is_point || {{ module }}.is_generic){
+  if ({{ module }}.is_point || {{ module }}.is_generic || {{ module }}.is_collection){
     {{ module }}.controls.push(new OpenLayers.Control.DrawFeature(lyr, OpenLayers.Handler.Point, {'displayClass': 'olControlDrawFeaturePoint'}));
   }
   if ({{ module }}.modifiable){
@@ -131,14 +161,24 @@ OpenLayers.Projection.addTransform("EPSG:4326", "EPSG:3857", OpenLayers.Layer.Sp
       if ({{ module }}.is_collection){
         // If geometry collection, add each component individually so they may be
         // edited individually.
-        for (var i = 0; i < {{ module }}.num_geom; i++){
-          {{ module }}.layers.vector.addFeatures([new OpenLayers.Feature.Vector(admin_geom.geometry.components[i].clone())]);
+        if ({{ module }}.collection_type == 'Any') {
+          {{ module }}.layers.vector.addFeatures(admin_geom);
+          var admin_bounds = new OpenLayers.Bounds();
+          for(var i = 0; i < {{ module }}.num_geom; i++){
+            admin_bounds.extend(admin_geom[i].geometry.getBounds());
+          }
+        } else {
+          for (var i = 0; i < {{ module }}.num_geom; i++){
+            {{ module }}.layers.vector.addFeatures([new OpenLayers.Feature.Vector(admin_geom.geometry.components[i].clone())]);
+          }
+          var admin_bounds = admin_geom.geometry.getBounds();
         }
       } else {
         {{ module }}.layers.vector.addFeatures([admin_geom]);
+        var admin_bounds = admin_geom.geometry.getBounds();
       }
       // Zooming to the bounds.
-      {{ module }}.map.zoomToExtent(admin_geom.geometry.getBounds());
+      {{ module }}.map.zoomToExtent(admin_bounds);
       if ({{ module }}.is_point){
           {{ module }}.map.zoomTo({{ point_zoom }});
       }
