Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #478 bug about missing multifield template in bootstrap3 #591

Merged
merged 1 commit into from
Feb 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 19 additions & 21 deletions crispy_forms/templates/bootstrap3/layout/multifield.html
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>
39 changes: 39 additions & 0 deletions crispy_forms/templates/bootstrap3/multifield.html
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 %}