-
-
Notifications
You must be signed in to change notification settings - Fork 732
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #591 from CodigoSur/multifield_bootstrap
Fixes #478 bug about missing multifield template in bootstrap3
- Loading branch information
Showing
2 changed files
with
58 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
{% load crispy_forms_field %} | ||
<div {% if multifield.css_id or errors %}id="{{ multifield.css_id }}"{% endif %} | ||
{% if multifield.css_class %}class="{{ multifield.css_class }}"{% endif %} | ||
{{ multifield.flat_attrs|safe }}> | ||
|
||
{% if field.is_hidden %} | ||
{{ field }} | ||
{% else %} | ||
|
||
{% if field.label %} | ||
<label for="{{ field.id_for_label }}"{% if labelclass %} class="{{ labelclass }}"{% endif %}> | ||
{% endif %} | ||
|
||
{% if field|is_checkbox %} | ||
{% crispy_field field %} | ||
{% if form_show_errors %} | ||
<div class="alert alert-danger" role="alert"> | ||
{% for field in multifield.bound_fields %} | ||
{% if field.errors %} | ||
{% for error in field.errors %} | ||
<p id="error_{{ forloop.counter }}_{{ field.auto_id }}">{{ error }}</p> | ||
{% endfor %} | ||
{% endif %} | ||
{% endfor %} | ||
</div> | ||
{% endif %} | ||
|
||
{% if field.label %} | ||
{{ field.label }} | ||
{% if multifield.label_html %} | ||
<p {% if multifield.label_class %}class="{{ multifield.label_class }}"{% endif %}>{{ multifield.label_html|safe }}</p> | ||
{% endif %} | ||
|
||
{% if not field|is_checkbox %} | ||
{% crispy_field field %} | ||
{% endif %} | ||
|
||
{% if field.label %} | ||
</label> | ||
{% endif %} | ||
<div class="multiField"> | ||
{{ fields_output|safe }} | ||
</div> | ||
|
||
{% endif %} | ||
</div> |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{% load crispy_forms_field %} | ||
|
||
{% if field.is_hidden %} | ||
{{ field }} | ||
{% else %} | ||
|
||
{% if field|is_checkbox %} | ||
{% if field.errors %}<div class="has-error">{% endif %} | ||
<div class="checkbox"> | ||
{% if field.label %} | ||
<label for="{{ field.id_for_label }}"{% if labelclass %} class="{{ labelclass }}"{% endif %}> | ||
{% endif %} | ||
|
||
{% crispy_field field %} | ||
{{ field.label }} | ||
|
||
{% if field.label %} | ||
</label> | ||
{% endif %} | ||
{% if field.help_text %} | ||
<p id="help_{{ field.auto_id }}" class="help-block">{{ field.help_text|safe }}</span> | ||
{% endif %} | ||
</div> | ||
{% if field.errors %}</div>{% endif %} | ||
{% else %} | ||
<div class="form-group {% if field.errors %}has-error{% endif %}"> | ||
{% if field.label %} | ||
<label class="control-label" for="{{ field.id_for_label }}"{% if labelclass %} class="{{ labelclass }}"{% endif %}> | ||
{{ field.label }} | ||
</label> | ||
{% endif %} | ||
{% crispy_field field %} | ||
{% if field.help_text %} | ||
<span id="help_{{ field.auto_id }}" class="help-block">{{ field.help_text|safe }}</span> | ||
{% endif %} | ||
</div> | ||
{% endif %} | ||
|
||
{% endif %} |