﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
10872	Support of 'list_editable' in admin when using GeoDjango geometry fields	springmeyer	nobody	"The post data sent from a GeoDjango geometry field currently fails when 'list_editable' is used in the Django Admin (when using the GeoDjango OSMGeoAdmin)

The problem occurs for two small reasons:

1) Because the geometry field is a textarea whose name is contructed from {{ field }} rather than {{ id }} the post data does not get prepended with the 'form-row' information.
 * See: http://code.djangoproject.com/browser/django/trunk/django/contrib/gis/templates/gis/admin/openlayers.html#L35

2) Because (I think) the geometry widget textarea is hidden the geometry field {{ id }} is prefixed with 'id_' unlike other fields I've noticed.

So, any easy fix for #1 is to use {{ id }} instead of {{ field }} like:
{{{
Index: django/contrib/gis/templates/gis/admin/openlayers.html
===================================================================
--- django/contrib/gis/templates/gis/admin/openlayers.html	(revision 10604)
+++ django/contrib/gis/templates/gis/admin/openlayers.html	(working copy)
@@ -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=""{{ id }}"">{{ wkt }}</textarea>
 <script type=""text/javascript"">{% block init_function %}{{ module }}.init();{% endblock %}</script>
 </span>

}}}

But that raises/creates issue #2 which effectively breaks the successful posting of data in both the list_editable changelist view and on the normal record view page (due to the 'id_' prefixing).

I've been looking through the commit (r10077) and the django forms trying to track down how and where and why this 'id_' gets prefixed. I can't quite suss out where it is happening well enough to feel like I know the right place to tackle this.

So, my best fix at this point is to strip the 'id_' off of the field id inside the geodjango form widget. The attached patch does that in a way to gets the list_editable working and still works great with the normal record edit/view page. So, a classic 'this patch works (seemingly) perfectly, but sucks : )

I'm concerned about some solution to this because I anticipate that once users running 1.1 discover this 'list_editable' feature I'm sure many using GeoDjango folks will want to try it out and will hit this."		closed	GIS	dev		fixed			Accepted	1	0	0	1	0	0
