Opened 8 years ago

Last modified 8 years ago

#28039 closed Bug

BaseGeometryWidget.subwidgets() crashes with KeyError 'widget' — at Version 4

Reported by: Dariusz Paluch Owned by: nobody
Component: GIS Version: 1.11
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

BaseGeometryWidget.get_context() doesn't execute super().get_context(self, name, value, attrs) so key 'widget' used by method subwidgets() doesn't exist.

Change History (4)

comment:1 by Tim Graham, 8 years ago

Can you provide a test case to reproduce the issue?

in reply to:  1 comment:2 by Dariusz Paluch, 8 years ago

Replying to Tim Graham:

Can you provide a test case to reproduce the issue?

Just use any BaseGeometryWidget based form field in form.

comment:3 by Tim Graham, 8 years ago

Component: FormsGIS
Severity: NormalRelease blocker
Summary: KeyError 'widget' in BaseGeometryWidgetBaseGeometryWidget.subwidgets() crashes with KeyError 'widget'
Triage Stage: UnreviewedAccepted

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

comment:4 by Tim Graham, 8 years ago

Description: modified (diff)
Has patch: set

Dariusz, could you your application with this PR. I'm not certain that it's correct.

Note: See TracTickets for help on using tickets.
Back to Top