aboutsummaryrefslogtreecommitdiffstats
path: root/main/py-django-oscar/0005-Fix-RemoteSelect-widget-for-Django-1.10-1.11.patch
blob: 5f3b07799fe248db88068ee2ec4369217abfc21c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 9732e0310b753cec3b8eb0f533c2d9dc9882de6c Mon Sep 17 00:00:00 2001
From: Michael van Tellingen <michael@mvantellingen.nl>
Date: Sat, 15 Apr 2017 10:15:52 +0200
Subject: [PATCH 5/8] Fix RemoteSelect widget for Django 1.10/1.11

We should probably just move to django-select2 in the future
---
 src/oscar/forms/widgets.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/oscar/forms/widgets.py b/src/oscar/forms/widgets.py
index c2a5ce7..6f0f5e7 100644
--- a/src/oscar/forms/widgets.py
+++ b/src/oscar/forms/widgets.py
@@ -1,3 +1,4 @@
+import copy
 import re
 
 import django
@@ -325,17 +326,15 @@ class RemoteSelect(forms.Widget):
             return six.text_type(value)
 
     def render(self, name, value, attrs=None, renderer=None):
-        attrs = {} if attrs is None else attrs
-
-        extra_attrs = {
+        attrs = {} if attrs is None else copy.copy(attrs)
+        attrs.update({
             'type': 'hidden',
             'name': name,
             'data-ajax-url': self.lookup_url,
             'data-multiple': 'multiple' if self.is_multiple else '',
             'value': self.format_value(value),
             'data-required': 'required' if self.is_required else '',
-        }
-        attrs = self.build_attrs(attrs, extra_attrs=extra_attrs)
+        })
         return mark_safe(u'<input %s>' % flatatt(attrs))
 
 
-- 
2.9.4