diff options
| author | Justin Bronn <jbronn@gmail.com> | 2009-04-26 06:08:26 +0000 |
|---|---|---|
| committer | Justin Bronn <jbronn@gmail.com> | 2009-04-26 06:08:26 +0000 |
| commit | d2c4c022516e3f6c3b7397ffc5235dfb6eda423b (patch) | |
| tree | a6a349e3aed8462909fdf4397ec4ffa598d2904c | |
| parent | 1269f9a3e96ed4d0913ba97b9bcc37427f560e84 (diff) | |
Fixed #10872 -- Geographic admin now supports new `list_editable` option. Thanks to Dane Springmeyer and Alex Gaynor for the solution.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10636 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/gis/admin/widgets.py | 9 | ||||
| -rw-r--r-- | django/contrib/gis/templates/gis/admin/openlayers.html | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/django/contrib/gis/admin/widgets.py b/django/contrib/gis/admin/widgets.py index 07263cbe80..be26261b54 100644 --- a/django/contrib/gis/admin/widgets.py +++ b/django/contrib/gis/admin/widgets.py @@ -38,9 +38,14 @@ class OpenLayersWidget(Textarea): # Constructing the dictionary of the map options. self.params['map_options'] = self.map_options() - # Constructing the JavaScript module name using the ID of + # Constructing the JavaScript module name using the name of # the GeometryField (passed in via the `attrs` keyword). - self.params['module'] = 'geodjango_%s' % self.params['field_name'] + # Use the 'name' attr for the field name (rather than 'field') + self.params['name'] = name + # note: we must switch out dashes for underscores since js + # functions are created using the module variable + js_safe_name = self.params['name'].replace('-','_') + self.params['module'] = 'geodjango_%s' % js_safe_name if value: # Transforming the geometry to the projection used on the diff --git a/django/contrib/gis/templates/gis/admin/openlayers.html b/django/contrib/gis/templates/gis/admin/openlayers.html index 361cac55b4..0870c65562 100644 --- a/django/contrib/gis/templates/gis/admin/openlayers.html +++ b/django/contrib/gis/templates/gis/admin/openlayers.html @@ -32,6 +32,6 @@ <div id="{{ id }}_map"{% if LANGUAGE_BIDI %} dir="ltr"{% endif %}></div> <a href="javascript:{{ module }}.clearFeatures()">Delete all Features</a> {% if display_wkt %}<p> WKT debugging window:</p>{% endif %} -<textarea id="{{ id }}" class="vWKTField required" cols="150" rows="10" name="{{ field_name }}">{{ wkt }}</textarea> +<textarea id="{{ id }}" class="vWKTField required" cols="150" rows="10" name="{{ name }}">{{ wkt }}</textarea> <script type="text/javascript">{% block init_function %}{{ module }}.init();{% endblock %}</script> </span> |
