Skip to content

Commit 27da6e8

Browse files
committed
Widgets' .render() method now must accept an additional keyword argument (renderer); adjusted the code accordingly (including a library patch -- pull request also submitted).
- Legacy-Id: 18056
1 parent a9348f1 commit 27da6e8

2 files changed

Lines changed: 38 additions & 2 deletions

File tree

ietf/liaisons/widgets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self, *args, **kwargs):
1717
self.required_label = kwargs.pop('required_label', None)
1818
super(ButtonWidget, self).__init__(*args, **kwargs)
1919

20-
def render(self, name, value, attrs=None):
20+
def render(self, name, value, **kwargs):
2121
html = '<span style="display: none" class="showAttachsOn">%s</span>' % conditional_escape(self.show_on)
2222
html += '<span style="display: none" class="attachEnabledLabel">%s</span>' % conditional_escape(self.label)
2323
if self.require:
@@ -30,7 +30,7 @@ def render(self, name, value, attrs=None):
3030

3131

3232
class ShowAttachmentsWidget(Widget):
33-
def render(self, name, value, attrs=None):
33+
def render(self, name, value, **kwargs):
3434
html = '<div id="id_%s">' % name
3535
html += '<span style="display: none" class="showAttachmentsEmpty form-control widget">No files attached</span>'
3636
html += '<div class="attachedFiles form-control widget">'
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
--- django_password_strength/widgets.py.orig 2020-06-24 16:07:28.479533134 +0200
2+
+++ django_password_strength/widgets.py 2020-06-24 16:08:09.540714290 +0200
3+
@@ -8,7 +8,7 @@
4+
Form widget to show the user how strong his/her password is.
5+
"""
6+
7+
- def render(self, name, value, attrs=None):
8+
+ def render(self, name, value, **kwargs):
9+
strength_markup = """
10+
<div style="margin-top: 10px;">
11+
<div class="progress" style="margin-bottom: 10px;">
12+
@@ -30,7 +30,7 @@
13+
except KeyError:
14+
self.attrs['class'] = 'password_strength'
15+
16+
- return mark_safe( super(PasswordInput, self).render(name, value, attrs) + strength_markup )
17+
+ return mark_safe( super(PasswordInput, self).render(name, value, **kwargs) + strength_markup )
18+
19+
class Media:
20+
js = (
21+
@@ -48,7 +48,7 @@
22+
super(PasswordConfirmationInput, self).__init__(attrs, render_value)
23+
self.confirm_with=confirm_with
24+
25+
- def render(self, name, value, attrs=None):
26+
+ def render(self, name, value, **kwargs):
27+
if self.confirm_with:
28+
self.attrs['data-confirm-with'] = 'id_%s' % self.confirm_with
29+
30+
@@ -68,4 +68,4 @@
31+
except KeyError:
32+
self.attrs['class'] = 'password_confirmation'
33+
34+
- return mark_safe( super(PasswordInput, self).render(name, value, attrs) + confirmation_markup )
35+
+ return mark_safe( super(PasswordInput, self).render(name, value, **kwargs) + confirmation_markup )
36+

0 commit comments

Comments
 (0)