Skip to content

Commit

Permalink
Fixed #10872 -- Geographic admin now supports new list_editable opt…
Browse files Browse the repository at this point in the history
…ion. 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
  • Loading branch information
jbronn committed Apr 26, 2009
1 parent 1269f9a commit d2c4c02
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions django/contrib/gis/admin/widgets.py
Expand Up @@ -38,9 +38,14 @@ def render(self, name, value, attrs=None):
# 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
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/gis/templates/gis/admin/openlayers.html
Expand Up @@ -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>

0 comments on commit d2c4c02

Please sign in to comment.