我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用django.forms.widgets.PasswordInput()。
def __init__(self, *args, **kwargs): super(LoginForm, self).__init__(*args, **kwargs) self.fields['username'].widget = widgets.TextInput(attrs={'placeholder': "username", "class": "form-control"}) self.fields['password'].widget = widgets.PasswordInput( attrs={'placeholder': "password", "class": "form-control"})
def __init__(self, *args, **kwargs): super(RegisterForm, self).__init__(*args, **kwargs) self.fields['username'].widget = widgets.TextInput(attrs={'placeholder': "username", "class": "form-control"}) self.fields['email'].widget = widgets.EmailInput(attrs={'placeholder': "email", "class": "form-control"}) self.fields['password1'].widget = widgets.PasswordInput( attrs={'placeholder': "password", "class": "form-control"}) self.fields['password2'].widget = widgets.PasswordInput( attrs={'placeholder': "repeat password", "class": "form-control"})