我们从Python开源项目中,提取了以下10个代码示例,用于说明如何使用django.contrib.auth.forms.ReadOnlyPasswordHashWidget()。
def add_class_attrs(self, widget=None): if widget is None: widget = self.widget classes = widget.attrs.get('class', '') if ReadOnlyPasswordHashWidget is not None and isinstance(widget, ReadOnlyPasswordHashWidget): # Render this is a static control classes = add_css_class(classes, 'form-control-static', prepend=True) elif not isinstance(widget, self.WIDGETS_NO_FORM_CONTROL): classes = add_css_class(classes, 'form-control', prepend=True) # For these widget types, add the size class here classes = add_css_class(classes, self.get_size_class()) if self.field.errors: if self.error_css_class: classes = add_css_class(classes, self.error_css_class) else: if self.field.form.is_bound: classes = add_css_class(classes, self.success_css_class) widget.attrs['class'] = classes
def add_class_attrs(self, widget=None): if not widget: widget = self.widget # for multiwidgets we recursively update classes for each sub-widget if isinstance(widget, AdminSplitDateTime): for w in widget.widgets: self.add_class_attrs(w) return classes = widget.attrs.get('class', '') if isinstance(widget, ReadOnlyPasswordHashWidget): classes = add_css_class(classes, 'form-control-static', prepend=True) elif isinstance(widget, (AdminDateWidget, AdminTimeWidget, RelatedFieldWidgetWrapper)): # for some admin widgets we don't want the input to take full horizontal space classes = add_css_class(classes, 'form-control form-control-inline', prepend=True) elif not isinstance(widget, (CheckboxInput, RadioSelect, CheckboxSelectMultiple, FileInput)): classes = add_css_class(classes, 'form-control', prepend=True) # For these widget types, add the size class here classes = add_css_class(classes, self.get_size_class()) widget.attrs['class'] = classes
def add_class_attrs(self, widget=None): if widget is None: widget = self.widget classes = widget.attrs.get('class', '') if ReadOnlyPasswordHashWidget is not None and isinstance(widget, ReadOnlyPasswordHashWidget): # Render this is a static control classes = add_css_class(classes, 'form-control-static', prepend=True) elif not isinstance(widget, self.WIDGETS_NO_FORM_CONTROL): classes = add_css_class(classes, 'form-control', prepend=True) # For these widget types, add the size class here classes = add_css_class(classes, self.get_size_class()) widget.attrs['class'] = classes
def add_class_attrs(self, widget=None): if widget is None: widget = self.widget classes = widget.attrs.get('class', '') if isinstance(widget, ReadOnlyPasswordHashWidget): # Render this is a static control classes = add_css_class(classes, 'form-control-static', prepend=True) elif not isinstance(widget, self.WIDGETS_NO_FORM_CONTROL): classes = add_css_class(classes, 'form-control', prepend=True) # For these widget types, add the size class here classes = add_css_class(classes, self.get_size_class()) widget.attrs['class'] = classes