Ticket #3409: widgets2.diff

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

widgets.py with PasswordInput taking render_value param

  • django/newforms/widgets.py

     
    8181class PasswordInput(Input):
    8282    input_type = 'password'
    8383
     84    def __init__(self, attrs=None, render_value=True):
     85        self.attrs = attrs or {}
     86        self.render_value = render_value
     87
     88    def render(self, name, value, attrs=None):
     89        if not self.render_value: value=None
     90        return super(PasswordInput, self).render(name, value, attrs)
     91
    8492class HiddenInput(Input):
    8593    input_type = 'hidden'
    8694    is_hidden = True
Back to Top