Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SupervisorForm(forms.Form):
- is_manager = forms.BooleanField(label=_("manager"), required=False)
- <input type="{{ widget.type }}" name="{{ widget.name }}"{% if widget.value != None %} value="{{ widget.value|stringformat:'s' }}"{% endif %}{% include "django/forms/widgets/attrs.html" %} />
- class SwitchWidgetCheckboxInput(ClearableFileInput):
- template_name = 'utils/SwitchWidgetCheckboxInput.html'
- @property
- def media(self):
- js = ("utils/switch_widget_checkbox_input/SwitchWidgetCheckboxInput.js",)
- css = {'all': ("utils/switch_widget_checkbox_input/SwitchWidgetCheckboxInput.css",)}
- return forms.Media(js=js, css=css)
- def render(self, name, value, attrs=None, renderer=None):
- """
- Returns this Widget rendered as HTML, as a Unicode string.
- """
- context = self.get_context(name, value, attrs)
- return self._render(self.template_name, context, renderer)
- class SupervisorForm(forms.Form):
- is_manager = forms.BooleanField(label=_("manager"), required=False, widget=SwitchWidgetCheckboxInput)
- <input type="{{ widget.type }}" name="{{ widget.name }}"{% if widget.value != None %} value="{{ widget.value|stringformat:'s' }}"{% endif %}{% include "django/forms/widgets/attrs.html" %} />
- <input type="checkbox" name="{{ widget.name }}"{% if widget.value != None %} value="{{ widget.value|stringformat:'s' }}"{% endif %}{% include "django/forms/widgets/attrs.html" %} />
Add Comment
Please, Sign In to add comment