Ticket #10872: geodjango_widget_list_editable_support.patch
File geodjango_widget_list_editable_support.patch, 3.1 KB (added by , 16 years ago) |
---|
-
django/contrib/gis/admin/widgets.py
37 37 38 38 # Constructing the dictionary of the map options. 39 39 self.params['map_options'] = self.map_options() 40 40 41 # hidden widgets don't set attrs in the same way as other widgets 42 # and therefore seem to accept the auto_id from here: 43 # http://code.djangoproject.com/browser/django/trunk/django/forms/forms.py#L376 44 # and therefore this id gets prefixed with 'id_' which breaks the form fields 45 # expected name when used in a formset 46 47 # so, an ugly hack therefore to strip the prefix here... 48 self.params['id'] = self.params['id'].lstrip('id_') #.replace('-','_') 49 41 50 # Constructing the JavaScript module name using the ID of 42 51 # the GeometryField (passed in via the `attrs` keyword). 43 self.params['module'] = 'geodjango_%s' % self.params['field_name'] 52 # javascript functions can't handle '-' so switch them out 53 self.params['module'] = self.params['id'].replace('-','_') 54 #self.params['module'] = 'geodjango_%s' % (self.params['field_name']) 44 55 45 56 if value: 46 57 # Transforming the geometry to the projection used on the -
django/contrib/gis/templates/gis/admin/openlayers.html
32 32 <div id="{{ id }}_map"{% if LANGUAGE_BIDI %} dir="ltr"{% endif %}></div> 33 33 <a href="javascript:{{ module }}.clearFeatures()">Delete all Features</a> 34 34 {% if display_wkt %}<p> WKT debugging window:</p>{% endif %} 35 <textarea id="{{ id }}" class="vWKTField required" cols="150" rows="10" name="{{ field_name}}">{{ wkt }}</textarea>35 <textarea id="{{ id }}" class="vWKTField required" cols="150" rows="10" name="{{ id }}">{{ wkt }}</textarea> 36 36 <script type="text/javascript">{% block init_function %}{{ module }}.init();{% endblock %}</script> 37 37 </span> -
django/contrib/gis/templates/gis/admin/openlayers.js
107 107 {{ module }}.map.addLayer({{ module }}.layers.base); 108 108 {% block extra_layers %}{% endblock %} 109 109 {% if is_linestring %}OpenLayers.Feature.Vector.style["default"]["strokeWidth"] = 3; // Default too thin for linestrings. {% endif %} 110 {{ module }}.layers.vector = new OpenLayers.Layer.Vector(" {{ field_name }}");110 {{ module }}.layers.vector = new OpenLayers.Layer.Vector("{{ module }}_vectors"); 111 111 {{ module }}.map.addLayer({{ module }}.layers.vector); 112 112 // Read WKT from the text field. 113 113 var wkt = document.getElementById('{{ id }}').value;