diff --git a/django/contrib/gis/admin/widgets.py b/django/contrib/gis/admin/widgets.py
index 47570d3f9daedf741dd74838a959c4cb8d86893b..0102484f1900f509798e6d606ae86dd02290d657 100644
a
|
b
|
class OpenLayersWidget(Textarea):
|
64 | 64 | # Setting the parameter WKT with that of the transformed |
65 | 65 | # geometry. |
66 | 66 | self.params['wkt'] = wkt |
| 67 | self.params['value'] = value |
67 | 68 | |
68 | 69 | return loader.render_to_string(self.template, self.params, |
69 | 70 | context_instance=geo_context) |
diff --git a/django/contrib/gis/templates/gis/admin/openlayers.html b/django/contrib/gis/templates/gis/admin/openlayers.html
index a61b68921f0182186274027d351e5c8af3213f4d..6dc244ae7ede6216b49bb231c61d35636b79792b 100644
a
|
b
|
|
31 | 31 | //]]> |
32 | 32 | </script> |
33 | 33 | <div id="{{ id }}_map"{% if LANGUAGE_BIDI %} dir="ltr"{% endif %}></div> |
| 34 | {% if not value or modifiable %} |
34 | 35 | <a href="javascript:{{ module }}.clearFeatures()">Delete all Features</a> |
| 36 | {% endif %} |
35 | 37 | {% if display_wkt %}<p> WKT debugging window:</p>{% endif %} |
36 | 38 | <textarea id="{{ id }}" class="vWKTField required" cols="150" rows="10" name="{{ name }}">{{ wkt }}</textarea> |
37 | 39 | <script type="text/javascript">{% block init_function %}{{ module }}.init();{% endblock %}</script> |
diff --git a/django/contrib/gis/tests/geoadmin/admin.py b/django/contrib/gis/tests/geoadmin/admin.py
new file mode 100644
index 0000000000000000000000000000000000000000..ab39c28885be89c9d8d6f07db6edf956facb2499
-
|
+
|
|
| 1 | from django.contrib.gis import admin |
| 2 | |
| 3 | |
| 4 | class UnmodifiableAdmin(admin.OSMGeoAdmin): |
| 5 | modifiable = False |
diff --git a/django/contrib/gis/tests/geoadmin/tests.py b/django/contrib/gis/tests/geoadmin/tests.py
index 6fadebdb9a89bac3470bd3bbbac28c29ae8caad7..16302707e2d2388fb2a69a84e2f07c2b61137cab 100644
a
|
b
|
from django.contrib.gis import admin
|
5 | 5 | from django.contrib.gis.geos import GEOSGeometry, Point |
6 | 6 | |
7 | 7 | from .models import City |
| 8 | from .admin import UnmodifiableAdmin |
8 | 9 | |
9 | 10 | |
10 | 11 | class GeoAdminTest(TestCase): |
… |
… |
class GeoAdminTest(TestCase):
|
23 | 24 | """geodjango_point.layers.base = new OpenLayers.Layer.OSM("OpenStreetMap (Mapnik)");""", |
24 | 25 | result) |
25 | 26 | |
| 27 | self.assertIn( |
| 28 | """<a href="javascript:geodjango_point.clearFeatures()">Delete all Features</a>""", |
| 29 | result) |
| 30 | |
| 31 | admin.site.unregister(City) |
| 32 | admin.site.register(City, UnmodifiableAdmin) |
| 33 | geoadmin = admin.site._registry[City] |
| 34 | result = geoadmin.get_map_widget(City._meta.get_field('point'))( |
| 35 | ).render('point', Point(-79.460734, 40.18476)) |
| 36 | |
| 37 | self.assertNotIn( |
| 38 | """<a href="javascript:geodjango_point.clearFeatures()">Delete all Features</a>""", |
| 39 | result) |
| 40 | |
| 41 | |
26 | 42 | def test_olmap_WMS_rendering(self): |
27 | 43 | admin.site.unregister(City) |
28 | 44 | admin.site.register(City, admin.GeoModelAdmin) |