Forked from alienhaxor/_formhelpers.py
Last active
September 5, 2022 17:44
Revisions
-
pwalsh revised this gist
Jun 4, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ {% macro render_field(field) -%} {% set with_label = kwargs.pop('with_label', False) %} {% set placeholder = kwargs.pop('placeholder', field.label.text) %} @@ -58,4 +58,4 @@ {% endif %} </div> {%- endmacro %} -
pwalsh revised this gist
Jun 4, 2014 . 1 changed file with 59 additions and 49 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,51 +1,61 @@ {% macro render_field(field) %} {% set with_label = kwargs.pop('with_label', False) %} {% set placeholder = kwargs.pop('placeholder', field.label.text) %} {% set class_ = kwargs.pop('class_', '') %} {% if field.flags.required %} {% set class_ = class_ + ' required' %} {% endif %} <div class="form-group {% if field.errors %}error{% endif %}"> {% if with_label %} <label for="{{ field.id }}" class="control-label{% if field.flags.required %} required{% endif %}"> {{ field.label.text }} </label> {% endif %} {% if field.type == 'BooleanField' %} <div class="checkbox"> <label> {{ field(class_=class_, **kwargs) }} {{ field.label.text|safe }} </label> </div> {% else %} {% if field.type in ('TextField', 'TextAreaField', 'PasswordField', 'IntegerField') %} {% set class_ = class_ + ' input-xlarge form-control' %} {% elif field.type == 'FileField' %} {% set class_ = class_ + ' input-file form-control' %} {% endif %} {% if field.type == 'SelectField' %} {{ field(class_=class_, **kwargs) }} {% else %} {{ field(class_=class_, placeholder=placeholder, **kwargs) }} {% endif %} {% endif %} {% if field.errors %} <span class="error help-inline">{{ field.errors|join(', ') }}</span> {% endif %} {% if field.description %} <p class="help-block">{{ field.description|safe }}</p> {% endif %} </div> {% endmacro %} -
pwalsh renamed this gist
Jun 4, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
CancerBalls renamed this gist
Oct 7, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
CancerBalls renamed this gist
Oct 7, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
CancerBalls revised this gist
Oct 7, 2013 . No changes.There are no files selected for viewing
-
CancerBalls revised this gist
Oct 7, 2013 . 1 changed file with 32 additions and 31 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,41 +10,42 @@ {{ field.label.text }}{% if field.flags.required %} *{% endif %}: </label> {% endif %} {% set class_ = kwargs.pop('class_', '') %} {% if field.flags.required %} {% set class_ = class_ + ' required' %} {% endif %} {% if field.type == 'BooleanField' %} <div class="checkbox"> <label> {{ field(class_=class_, **kwargs) }} {{ field.label.text|safe }} </label> </div> {% else %} {% if field.type in ('TextField', 'TextAreaField', 'PasswordField') %} {% set class_ = class_ + ' input-xlarge form-control' %} {% elif field.type == 'FileField' %} {% set class_ = class_ + ' input-file form-control' %} {% endif %} {% if field.type == 'SelectField' %} {{ field(class_=class_, **kwargs) }} {% else %} {{ field(class_=class_, placeholder=placeholder, **kwargs) }} {% endif %} {% endif %} {% if field.errors %} <span class="error help-inline">{{ field.errors|join(', ') }}</span> {% endif %} {% if field.description %} <p class="help-block">{{ field.description|safe }}</p> {% endif %} </div> {%- endmacro %} -
CancerBalls revised this gist
Oct 7, 2013 . 1 changed file with 21 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,39 +1,50 @@ {% macro render_field(field) -%} {% set with_label = kwargs.pop('with_label', False) %} {% set placeholder = '' %} {% if not with_label %} {% set placeholder = field.label.text %} {% endif %} <div class="form-group {% if field.errors %}error{% endif %}"> {% if with_label %} <label for="{{ field.id }}" class="control-label"> {{ field.label.text }}{% if field.flags.required %} *{% endif %}: </label> {% endif %} {% set class_ = kwargs.pop('class_', '') %} {% if field.flags.required %} {% set class_ = class_ + ' required' %} {% endif %} {% if field.type == 'BooleanField' %} <div class="checkbox"> <label> {{ field(class_=class_, **kwargs) }} {{ field.label.text|safe }} </label> </div> {% else %} {% if field.type in ('TextField', 'TextAreaField', 'PasswordField') %} {% set class_ = class_ + ' input-xlarge form-control' %} {% elif field.type == 'FileField' %} {% set class_ = class_ + ' input-file form-control' %} {% endif %} {% if field.type == 'SelectField' %} {{ field(class_=class_, **kwargs) }} {% else %} {{ field(class_=class_, placeholder=placeholder, **kwargs) }} {% endif %} {% endif %} {% if field.errors %} <span class="error help-inline">{{ field.errors|join(', ') }}</span> {% endif %} {% if field.description %} <p class="help-block">{{ field.description|safe }}</p> {% endif %} </div> {%- endmacro %} -
maximebf created this gist
Oct 31, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ {% macro form_field(field) -%} {% set with_label = kwargs.pop('with_label', False) %} {% set placeholder = '' %} {% if not with_label %} {% set placeholder = field.label.text %} {% endif %} <div class="control-group {% if field.errors %}error{% endif %}"> {% if with_label %} <label for="{{ field.id }}" class="control-label"> {{ field.label.text }}{% if field.flags.required %} *{% endif %}: </label> {% endif %} <div class="controls"> {% set class_ = kwargs.pop('class_', '') %} {% if field.flags.required %} {% set class_ = class_ + ' required' %} {% endif %} {% if field.type == 'BooleanField' %} <label class="checkbox"> {{ field(class_=class_, **kwargs) }} {{ field.label.text|safe }} </label> {% else %} {% if field.type in ('TextField', 'TextAreaField', 'PasswordField') %} {% set class_ = class_ + ' input-xlarge' %} {% elif field.type == 'FileField' %} {% set class_ = class_ + ' input-file' %} {% endif %} {{ field(class_=class_, placeholder=placeholder, **kwargs) }} {% endif %} {% if field.errors %} <span class="error help-inline">{{ field.errors|join(', ') }}</span> {% endif %} {% if field.description %} <p class="help-block">{{ field.description|safe }}</p> {% endif %} </div> </div> {%- endmacro %}