--
Ticket URL: <https://code.djangoproject.com/ticket/28039>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Tim Graham):
Can you provide a test case to reproduce the issue?
--
Ticket URL: <https://code.djangoproject.com/ticket/28039#comment:1>
Comment (by Dariusz Paluch):
Replying to [comment:1 Tim Graham]:
> Can you provide a test case to reproduce the issue?
Just use any BaseGeometryWidget based form field in form.
--
Ticket URL: <https://code.djangoproject.com/ticket/28039#comment:2>
* component: Forms => GIS
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted
Comment:
Here's a snippet to reproduce:
{{{
>>> from django.contrib.gis.forms import OpenLayersWidget
>>> widget = forms.OpenLayersWidget()
>>> list(widget.subwidgets('name', 'value'))
Traceback (most recent call last):
...
File "django/django/forms/widgets.py", line 177, in subwidgets
yield context['widget']
KeyError: 'widget
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28039#comment:3>
* has_patch: 0 => 1
Old description:
> BaseGeometryWidget get_context doesn't execute super().get_context(self,
> name, value, attrs) so key 'widget' used by method subwidgets doesn't
> exists.
New description:
`BaseGeometryWidget.get_context()` doesn't execute
`super().get_context(self, name, value, attrs)` so key `'widget'` used by
method `subwidgets()` doesn't exist.
--
Comment:
Dariusz, could you your application with this
[https://github.com/django/django/pull/8343 PR]. I'm not certain that it's
correct.
--
Ticket URL: <https://code.djangoproject.com/ticket/28039#comment:4>
Comment (by dpaluch-rp):
Replying to [comment:4 Tim Graham]:
> Dariusz, could you your application with this
[https://github.com/django/django/pull/8343 PR]. I'm not certain that it's
correct.
I'm fixed my application the same way.
```class GoogleMapWidget(forms.BaseGeometryWidget):
map_width = 800
map_height = 500
template_name = 'gis/google.html'
def serialize(self, value):
return value.geojson if value else ''
def get_context(self, name, value, attrs):
# TODO: Bug Django 1.11, BaseGeometryWidget.get_context don't call
super(), so context don't have "widget" key
context = super().get_context(name, value, attrs)
super_context = super(forms.BaseGeometryWidget,
self).get_context(name, value, attrs)
super_context.update(context)
return super_context
```
--
Ticket URL: <https://code.djangoproject.com/ticket/28039#comment:5>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"d2cb7a2bc11f111be04a29b5e4f92a183b18ba88" d2cb7a2b]:
{{{
#!CommitTicketReference repository=""
revision="d2cb7a2bc11f111be04a29b5e4f92a183b18ba88"
Fixed #28039 -- Fixed crash in BaseGeometryWidget.subwidgets().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28039#comment:6>
Comment (by Tim Graham <timograham@…>):
In [changeset:"5e2bbcd70c9b0213bfda31b90e4b1c35815880e9" 5e2bbcd7]:
{{{
#!CommitTicketReference repository=""
revision="5e2bbcd70c9b0213bfda31b90e4b1c35815880e9"
[1.11.x] Fixed #28039 -- Fixed crash in BaseGeometryWidget.subwidgets().
Backport of d2cb7a2bc11f111be04a29b5e4f92a183b18ba88 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28039#comment:7>