Fix the compatibility after django 1.11 support
In patch[1], the change didn't completely fix the issue that can't open NGT creating widget if django didn't upgrade to the lastest version 1.11. This patch fixes the issue by rewriting the method "build_attrs". [1] https://review.openstack.org/#/c/489576/ Change-Id: I748c71fd26d3abaf4a059db3c2224589284131c6
This commit is contained in:
parent
33d9525c1d
commit
b624278524
|
@ -300,11 +300,21 @@ class SecurityConfigAction(workflows.Action):
|
|||
|
||||
|
||||
class CheckboxSelectMultiple(forms.CheckboxSelectMultiple):
|
||||
# TODO(shuyingya): should rewrite this class using the
|
||||
# new method "get_context" when Django version less than 1.11
|
||||
# no longer support.
|
||||
def build_attrs(self, extra_attrs=None, **kwargs):
|
||||
"Helper function for building an attribute dictionary."
|
||||
attrs = dict(self.attrs, **kwargs)
|
||||
if extra_attrs:
|
||||
attrs.update(extra_attrs)
|
||||
return attrs
|
||||
|
||||
def render(self, name, value, attrs=None, choices=()):
|
||||
if value is None:
|
||||
value = []
|
||||
has_id = attrs and 'id' in attrs
|
||||
final_attrs = self.build_attrs(attrs, {'name': name})
|
||||
final_attrs = self.build_attrs(attrs, name=name)
|
||||
output = []
|
||||
initial_service = uuidutils.generate_uuid()
|
||||
str_values = set([encoding.force_text(v) for v in value])
|
||||
|
|
Loading…
Reference in New Issue