Python django.forms.widgets.PasswordInput() Examples
The following are 6
code examples of django.forms.widgets.PasswordInput().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.forms.widgets
, or try the search function
.
Example #1
Source File: forms.py From Django-blog with MIT License | 10 votes |
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # 只修改widget self.fields['username'].widget = widgets.TextInput( attrs={ 'placeholder': 'Username', 'class': 'form-control', 'style': 'margin-bottom: 10px' }) self.fields['email'].widget = widgets.EmailInput( attrs={ 'placeholder': 'Email', 'class': 'form-control' }) self.fields['password1'].widget = widgets.PasswordInput( attrs={ 'placeholder': 'New password', 'class': 'form-control' }) self.fields['password2'].widget = widgets.PasswordInput( attrs={ 'placeholder': 'Repeat password', 'class': 'form-control' })
Example #2
Source File: forms.py From callisto-core with GNU Affero General Public License v3.0 | 7 votes |
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields["new_password1"] = CharField( min_length=settings.PASSWORD_MIN_LENGTH, max_length=settings.PASSWORD_MAX_LENGTH, label="Enter your new password", widget=PasswordInput(attrs={"autocomplete": "off"}), error_messages={"required": REQUIRED_ERROR.format("password")}, ) self.fields["new_password2"].label = "Confirm new password" self.fields["new_password2"].widget.attrs["autocomplete"] = "off" self.fields["old_password"].label = "Old password" self.fields["old_password"].widget.attrs["autocomplete"] = "off" # in original PasswordChangeForm file to reorder fields
Example #3
Source File: forms.py From Django-blog with MIT License | 6 votes |
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['username'].widget = widgets.TextInput( attrs={ 'placeholder': 'Username', 'class': 'form-control', 'style': 'margin-bottom: 10px', 'autofocus': True }) self.fields['password'].widget = widgets.PasswordInput( attrs={ 'placeholder': 'Password', 'class': 'form-control' } )
Example #4
Source File: widgets.py From lexpredict-contraxsuite with GNU Affero General Public License v3.0 | 5 votes |
def get_context(self, name, value, attrs): if not self.render_value: value = self.empty_password_value return super(PasswordInput, self).get_context(name, value, attrs)
Example #5
Source File: forms.py From callisto-core with GNU Affero General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields["new_password1"] = CharField( max_length=settings.PASSWORD_MAX_LENGTH, min_length=settings.PASSWORD_MIN_LENGTH, label=self.password1_label, widget=PasswordInput(), error_messages={"required": REQUIRED_ERROR.format("password")}, )
Example #6
Source File: views.py From panhandler with Apache License 2.0 | 4 votes |
def generate_dynamic_form(self, data=None) -> Form: form = Form(data=data) meta = self.meta if meta is None: raise SnippetRequiredException('Could not find a valid skillet!!') mode = self.get_value_from_workflow('mode', 'online') if mode == 'online': self.title = 'PAN-OS NGFW to Validate' self.help_text = 'This form allows you to enter the connection information for a PAN-OS NGFW. This' \ 'tool will connect to that device and pull it\'s configuration to perform the' \ 'validation.' target_ip_label = 'Target IP' target_username_label = 'Target Username' target_password_label = 'Target Password' target_ip = self.get_value_from_workflow('TARGET_IP', '') # target_port = self.get_value_from_workflow('TARGET_PORT', 443) target_username = self.get_value_from_workflow('TARGET_USERNAME', '') target_password = self.get_value_from_workflow('TARGET_PASSWORD', '') target_ip_field = fields.CharField(label=target_ip_label, initial=target_ip, required=True, validators=[FqdnOrIp]) target_username_field = fields.CharField(label=target_username_label, initial=target_username, required=True) target_password_field = fields.CharField(widget=widgets.PasswordInput(render_value=True), required=True, label=target_password_label, initial=target_password) form.fields['TARGET_IP'] = target_ip_field form.fields['TARGET_USERNAME'] = target_username_field form.fields['TARGET_PASSWORD'] = target_password_field else: self.title = 'PAN-OS XML Configuration to Validate' self.help_text = 'This form allows you to paste in a full configuration from a PAN-OS NGFW. This ' \ 'will then be used to perform the validation.' label = 'Configuration' initial = self.get_value_from_workflow('config', '<xml></xml>') help_text = 'Paste the full XML configuration file to validate here.' config_field = fields.CharField(label=label, initial=initial, required=True, help_text=help_text, widget=widgets.Textarea(attrs={'cols': 40})) form.fields['config'] = config_field return form