Commit f3450547 authored by Michael Fladischer's avatar Michael Fladischer

New upstream version 1.7.2

parent 3f58be29
# CHANGELOG for django-crispy-forms # CHANGELOG for django-crispy-forms
## 1.7.2 (2018/03/09)
* Bugfixes following v1.7.1
See [1.7.1 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/6?closed=1)
for full issue list.
## 1.7.1 (2018/03/05) ## 1.7.1 (2018/03/05)
* Bootstrap 4 template pack. * Bootstrap 4 template pack.
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
__version__ = '1.7.1' __version__ = '1.7.2'
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
{% include 'bootstrap/layout/field_errors_block.html' %} {% include 'bootstrap/layout/field_errors_block.html' %}
{% for choice in field.field.choices %} {% for choice in field.field.choices %}
<label class="checkbox{% if inline_class %} {{ inline_class }}{% endif %}"> <label class="checkbox{% if inline_class %} {{ inline_class }}{% endif %}" for="id_{{ field.html_name }}_{{ forloop.counter }}">
<input type="checkbox"{% if choice.0 in field.value or choice.0|stringformat:"s" in field.value or choice.0|stringformat:"s" == field.value|default_if_none:""|stringformat:"s" %} checked="checked"{% endif %} name="{{ field.html_name }}" id="id_{{ field.id_for_label }}_{{ forloop.counter }}" value="{{ choice.0|unlocalize }}" {{ field.field.widget.attrs|flatatt }}>{{ choice.1|unlocalize }} <input type="checkbox"{% if choice.0 in field.value or choice.0|stringformat:"s" in field.value or choice.0|stringformat:"s" == field.value|default_if_none:""|stringformat:"s" %} checked="checked"{% endif %} name="{{ field.html_name }}" id="id_{{ field.html_name }}_{{ forloop.counter }}" value="{{ choice.0|unlocalize }}" {{ field.field.widget.attrs|flatatt }}>{{ choice.1|unlocalize }}
</label> </label>
{% endfor %} {% endfor %}
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
{% for choice in field.field.choices %} {% for choice in field.field.choices %}
{% if not inline_class %}<div class="checkbox">{% endif %} {% if not inline_class %}<div class="checkbox">{% endif %}
<label class="{% if inline_class %}checkbox-{{ inline_class }}{% endif %}"> <label class="{% if inline_class %}checkbox-{{ inline_class }}{% endif %}" for="id_{{ field.html_name }}_{{ forloop.counter }}">
<input type="checkbox"{% if choice.0 in field.value or choice.0|stringformat:"s" in field.value or choice.0|stringformat:"s" == field.value|default_if_none:""|stringformat:"s" %} checked="checked"{% endif %} name="{{ field.html_name }}" id="id_{{ field.id_for_label }}_{{ forloop.counter }}" value="{{ choice.0|unlocalize }}" {{ field.field.widget.attrs|flatatt }}>{{ choice.1|unlocalize }} <input type="checkbox"{% if choice.0 in field.value or choice.0|stringformat:"s" in field.value or choice.0|stringformat:"s" == field.value|default_if_none:""|stringformat:"s" %} checked="checked"{% endif %} name="{{ field.html_name }}" id="id_{{ field.html_name }}_{{ forloop.counter }}" value="{{ choice.0|unlocalize }}" {{ field.field.widget.attrs|flatatt }}>{{ choice.1|unlocalize }}
</label> </label>
{% if not inline_class %}</div>{% endif %} {% if not inline_class %}</div>{% endif %}
{% endfor %} {% endfor %}
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<div class="{% for offset in bootstrap_checkbox_offsets %}{{ offset }} {% endfor %}{{ field_class }}"> <div class="{% for offset in bootstrap_checkbox_offsets %}{{ offset }} {% endfor %}{{ field_class }}">
{% endif %} {% endif %}
{% endif %} {% endif %}
<{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" class="{% if not field|is_checkbox %}form-group{% if 'form-horizontal' in form_class %} row{% endif %}{% else %}form-check{% endif %}{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors%}{% if field.errors %} invalid-feedback{% endif %}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}"> <{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" class="{% if not field|is_checkbox %}form-group{% if 'form-horizontal' in form_class %} row{% endif %}{% else %}form-check{% endif %}{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
{% if field.label and not field|is_checkbox and form_show_labels %} {% if field.label and not field|is_checkbox and form_show_labels %}
<label for="{{ field.id_for_label }}" class="col-form-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}"> <label for="{{ field.id_for_label }}" class="col-form-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %} {{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
{% for choice in field.field.choices %} {% for choice in field.field.choices %}
{% if not inline_class %}<div class="form-check">{% endif %} {% if not inline_class %}<div class="form-check">{% endif %}
<label id="id_{{ field.id_for_label }}_{{ forloop.counter }}" class="form-check-{% if inline_class %}{{ inline_class }}{% else %}label{% endif %}"> <label id="id_{{ field.id_for_label }}_{{ forloop.counter }}" class="form-check-{% if inline_class %}{{ inline_class }}{% else %}label{% endif %}" for="id_{{ field.html_name }}_{{ forloop.counter }}">
<input type="checkbox" class="form-check-input"{% if choice.0 in field.value or choice.0|stringformat:"s" in field.value or choice.0|stringformat:"s" == field.value|default_if_none:""|stringformat:"s" %} checked="checked"{% endif %} name="{{ field.html_name }}" id="id_{{ field.id_for_label }}_{{ forloop.counter }}" value="{{ choice.0|unlocalize }}" {{ field.field.widget.attrs|flatatt }}> <input type="checkbox" class="form-check-input"{% if choice.0 in field.value or choice.0|stringformat:"s" in field.value or choice.0|stringformat:"s" == field.value|default_if_none:""|stringformat:"s" %} checked="checked"{% endif %} name="{{ field.html_name }}" id="id_{{ field.html_name }}_{{ forloop.counter }}" value="{{ choice.0|unlocalize }}" {{ field.field.widget.attrs|flatatt }}>
{{ choice.1|unlocalize }} {{ choice.1|unlocalize }}
</label> </label>
{% if not inline_class %}</div>{% endif %} {% if not inline_class %}</div>{% endif %}
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<div class="{{ field_class }}"> <div class="{{ field_class }}">
<div class="input-group"> <div class="input-group">
{% crispy_field field %} {% crispy_field field %}
<span class="input-group-btn{% if active %} active{% endif %}{% if input_size %} {{ input_size }}{% endif %}">{{ buttons|safe }}</span> <span class="input-group-append{% if active %} active{% endif %}{% if input_size %} {{ input_size }}{% endif %}">{{ buttons|safe }}</span>
</div> </div>
{% include 'bootstrap4/layout/help_text_and_errors.html' %} {% include 'bootstrap4/layout/help_text_and_errors.html' %}
</div> </div>
......
...@@ -439,8 +439,10 @@ class TestBootstrapLayoutObjects(object): ...@@ -439,8 +439,10 @@ class TestBootstrapLayoutObjects(object):
if settings.CRISPY_TEMPLATE_PACK == 'bootstrap': if settings.CRISPY_TEMPLATE_PACK == 'bootstrap':
assert html.count('class="input-append"') == 1 assert html.count('class="input-append"') == 1
elif settings.CRISPY_TEMPLATE_PACK in ['bootstrap3', 'bootstrap4']: elif settings.CRISPY_TEMPLATE_PACK == 'bootstrap3':
assert html.count('class="input-group-btn') == 1 assert html.count('class="input-group-btn') == 1
elif settings.CRISPY_TEMPLATE_PACK == 'bootstrap4':
assert html.count('class="input-group-append') == 1
def test_hidden_fields(self): def test_hidden_fields(self):
form = SampleForm() form = SampleForm()
...@@ -480,3 +482,23 @@ class TestBootstrapLayoutObjects(object): ...@@ -480,3 +482,23 @@ class TestBootstrapLayoutObjects(object):
assert html.count('checkbox-inline"') == 3 assert html.count('checkbox-inline"') == 3
elif settings.CRISPY_TEMPLATE_PACK == 'bootstrap4': elif settings.CRISPY_TEMPLATE_PACK == 'bootstrap4':
assert html.count('form-check-inline"') == 3 assert html.count('form-check-inline"') == 3
def test_multiple_checkboxes_unique_ids(self):
test_form = CheckboxesSampleForm()
html = render_crispy_form(test_form)
expected_ids = [
'checkboxes_1',
'checkboxes_2',
'checkboxes_3',
'alphacheckboxes_1',
'alphacheckboxes_2',
'alphacheckboxes_3',
'numeric_multiple_checkboxes_1',
'numeric_multiple_checkboxes_2',
'numeric_multiple_checkboxes_3',
]
for id_suffix in expected_ids:
expected_str = 'id="id_{id_suffix}"'.format(id_suffix=id_suffix)
assert html.count(expected_str) == 1
...@@ -39,7 +39,7 @@ Since version 1.1.0, django-crispy-forms has built-in support for different CSS ...@@ -39,7 +39,7 @@ Since version 1.1.0, django-crispy-forms has built-in support for different CSS
* ``bootstrap`` `Bootstrap`_ is crispy-forms's default template pack, version 2 of the popular simple and flexible HTML, CSS, and Javascript for user interfaces from Twitter. * ``bootstrap`` `Bootstrap`_ is crispy-forms's default template pack, version 2 of the popular simple and flexible HTML, CSS, and Javascript for user interfaces from Twitter.
* ``bootstrap3`` Twitter Bootstrap version 3. * ``bootstrap3`` Twitter Bootstrap version 3.
* ``bootstrap4`` Alpha support for Twitter Bootstrap version 4, which is still in Alpha. * ``bootstrap4`` support for Twitter Bootstrap version 4.
* ``uni-form`` `Uni-form`_ is a nice looking, well structured, highly customizable, accessible and usable forms. * ``uni-form`` `Uni-form`_ is a nice looking, well structured, highly customizable, accessible and usable forms.
* ``foundation`` `Foundation`_ In the creator's words, "The most advanced responsive front-end framework in the world." This template pack is externally available through `crispy-forms-foundation`_ * ``foundation`` `Foundation`_ In the creator's words, "The most advanced responsive front-end framework in the world." This template pack is externally available through `crispy-forms-foundation`_
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment