Removed debug statements, added comments
This commit is contained in:
@@ -10,6 +10,10 @@ from django.utils.encoding import force_unicode
|
|||||||
|
|
||||||
|
|
||||||
class PlainWidget(forms.widgets.Widget):
|
class PlainWidget(forms.widgets.Widget):
|
||||||
|
"""
|
||||||
|
Class to define a form widget that effectively nulls the htmls of a
|
||||||
|
widget and reduces the output to only it's value
|
||||||
|
"""
|
||||||
def render(self, name, value, attrs=None):
|
def render(self, name, value, attrs=None):
|
||||||
return mark_safe(u'%s' % value)
|
return mark_safe(u'%s' % value)
|
||||||
|
|
||||||
@@ -70,6 +74,11 @@ def two_state_template(state, famfam_ok_icon=u'tick', famfam_fail_icon=u'cross')
|
|||||||
|
|
||||||
|
|
||||||
class TextAreaDiv(forms.widgets.Widget):
|
class TextAreaDiv(forms.widgets.Widget):
|
||||||
|
"""
|
||||||
|
Class to define a form widget that simulates the behavior of a
|
||||||
|
Textarea widget but using a div tag instead
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, attrs=None):
|
def __init__(self, attrs=None):
|
||||||
# The 'rows' and 'cols' attributes are required for HTML correctness.
|
# The 'rows' and 'cols' attributes are required for HTML correctness.
|
||||||
default_attrs = {'class': 'text_area_div'}
|
default_attrs = {'class': 'text_area_div'}
|
||||||
@@ -89,6 +98,10 @@ class TextAreaDiv(forms.widgets.Widget):
|
|||||||
|
|
||||||
# From: http://www.peterbe.com/plog/emailinput-html5-django
|
# From: http://www.peterbe.com/plog/emailinput-html5-django
|
||||||
class EmailInput(forms.widgets.Input):
|
class EmailInput(forms.widgets.Input):
|
||||||
|
"""
|
||||||
|
Class for a login form widget that accepts only well formated
|
||||||
|
email address
|
||||||
|
"""
|
||||||
input_type = 'email'
|
input_type = 'email'
|
||||||
|
|
||||||
def render(self, name, value, attrs=None):
|
def render(self, name, value, attrs=None):
|
||||||
@@ -101,6 +114,11 @@ class EmailInput(forms.widgets.Input):
|
|||||||
|
|
||||||
|
|
||||||
class ScrollableCheckboxSelectMultiple(forms.widgets.CheckboxSelectMultiple):
|
class ScrollableCheckboxSelectMultiple(forms.widgets.CheckboxSelectMultiple):
|
||||||
|
"""
|
||||||
|
Class for a form widget composed of a selection of checkboxes wrapped
|
||||||
|
in a div tag with automatic overflow to add scrollbars when the list
|
||||||
|
exceds the height of the div
|
||||||
|
"""
|
||||||
def render(self, name, value, attrs=None, choices=()):
|
def render(self, name, value, attrs=None, choices=()):
|
||||||
if value is None: value = []
|
if value is None: value = []
|
||||||
has_id = attrs and 'id' in attrs
|
has_id = attrs and 'id' in attrs
|
||||||
@@ -123,8 +141,5 @@ class ScrollableCheckboxSelectMultiple(forms.widgets.CheckboxSelectMultiple):
|
|||||||
option_label = conditional_escape(force_unicode(option_label))
|
option_label = conditional_escape(force_unicode(option_label))
|
||||||
output.append(u'<li><label%s>%s %s</label></li>' % (label_for, rendered_cb, option_label))
|
output.append(u'<li><label%s>%s %s</label></li>' % (label_for, rendered_cb, option_label))
|
||||||
output.append(u'</ul>')
|
output.append(u'</ul>')
|
||||||
#return mark_safe(u'\n'.join(output))
|
|
||||||
result = u'\n'.join(output)
|
|
||||||
|
|
||||||
#result = super(ScrollableCheckboxSelectMultiple, self).render(name, value, attrs=None, choices=())
|
return mark_safe(u'<div class="text_area_div">%s</div>' % u'\n'.join(output))
|
||||||
return mark_safe(u'<div class="text_area_div">%s</div>' % result)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user