diff options
| author | Dylan Verheul <dylan@zostera.nl> | 2017-04-29 15:35:46 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-04-30 21:13:50 -0400 |
| commit | b1aea89dee4598857aaa3847f996e7cd03316a10 (patch) | |
| tree | f1e35df043673e8bd694456332c904eb1c6d2769 /django | |
| parent | a2975cb083a01012eb0cb997f0f5b7c2263cfbba (diff) | |
[1.11.x] Fixed #28105 -- Fixed crash in BaseGeometryWidget.get_context() when overriding existing attrs.
Backport of 75aeebebfe3df3ea46b8e12dd5e7719f98664d3a from master
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/gis/forms/widgets.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/django/contrib/gis/forms/widgets.py b/django/contrib/gis/forms/widgets.py index cc82f41563..ea410d2e8a 100644 --- a/django/contrib/gis/forms/widgets.py +++ b/django/contrib/gis/forms/widgets.py @@ -65,15 +65,16 @@ class BaseGeometryWidget(Widget): if attrs is None: attrs = {} - context.update(self.build_attrs(self.attrs, dict( - name=name, - module='geodjango_%s' % name.replace('-', '_'), # JS-safe - serialized=self.serialize(value), - geom_type=gdal.OGRGeomType(self.attrs['geom_type']), - STATIC_URL=settings.STATIC_URL, - LANGUAGE_BIDI=translation.get_language_bidi(), - **attrs - ))) + build_attrs_kwargs = { + 'name': name, + 'module': 'geodjango_%s' % name.replace('-', '_'), # JS-safe + 'serialized': self.serialize(value), + 'geom_type': gdal.OGRGeomType(self.attrs['geom_type']), + 'STATIC_URL': settings.STATIC_URL, + 'LANGUAGE_BIDI': translation.get_language_bidi(), + } + build_attrs_kwargs.update(attrs) + context.update(self.build_attrs(self.attrs, build_attrs_kwargs)) return context |
