Code

Ticket #3409: widgets2.diff

File widgets2.diff, 650 bytes (added by scott@…, 7 years ago)

widgets.py with PasswordInput taking render_value param

Line 
1Index: django/newforms/widgets.py
2===================================================================
3--- django/newforms/widgets.py  (revision 4454)
4+++ django/newforms/widgets.py  (working copy)
5@@ -81,6 +81,14 @@
6 class PasswordInput(Input):
7     input_type = 'password'
8 
9+    def __init__(self, attrs=None, render_value=True):
10+        self.attrs = attrs or {}
11+        self.render_value = render_value
12+
13+    def render(self, name, value, attrs=None):
14+        if not self.render_value: value=None
15+        return super(PasswordInput, self).render(name, value, attrs)
16+
17 class HiddenInput(Input):
18     input_type = 'hidden'
19     is_hidden = True