Python django.forms.widgets.RadioSelect() Examples
The following are 3
code examples of django.forms.widgets.RadioSelect().
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: form_display.py From coursys with GNU General Public License v3.0 | 6 votes |
def field_display(field, safe=False): out = [] if isinstance(field.field.widget, (forms.widgets.RadioSelect, forms.widgets.CheckboxSelectMultiple)): out.append('<div class="field radio">%s</div>' % (str(field))) else: out.append('<div class="field">%s</div>' % (str(field))) out.append(str(field.errors)) if field.help_text: if isinstance(field.help_text, Promise): out.append('<div class="helptext">%s</div>' % (escape(field.help_text))) else: if safe: out.append('<div class="helptext">%s</div>' % (field.help_text)) else: out.append('<div class="helptext">%s</div>' % (escape(field.help_text))) return mark_safe('\n'.join(out))
Example #2
Source File: form_display.py From coursys with GNU General Public License v3.0 | 6 votes |
def label_display(field, prefix=''): out = [] labelid = str(field.name) if prefix: labelid = prefix + '-' + labelid if isinstance(field.field.widget, (RadioSelect, SupervisorWidget)): labelid += '_0' out.append('<label for="id_%s">' % (labelid,)) out.append(escape(field.label)) out.append(':') if field.field.required or (hasattr(field.field, 'force_display_required') and field.field.force_display_required): out.append(' ' + required_icon) out.append('</label>') return mark_safe(''.join(out))
Example #3
Source File: bootstrap_toolkit.py From yats with MIT License | 6 votes |
def bootstrap_input_type(field): """ Return input type to use for field """ try: widget = field.field.widget except: raise ValueError("Expected a Field, got a %s" % type(field)) input_type = getattr(widget, 'bootstrap_input_type', None) if input_type: return str(input_type) if isinstance(widget, TextInput): return u'text' if isinstance(widget, CheckboxInput): return u'checkbox' if isinstance(widget, CheckboxSelectMultiple): return u'multicheckbox' if isinstance(widget, RadioSelect): return u'radioset' return u'default'