[Python-modules-commits] [python-django-crispy-forms] 02/10: Import python-django-crispy-forms_1.6.1.orig.tar.gz

Michael Fladischer fladi at moszumanska.debian.org
Fri Oct 28 06:42:38 UTC 2016


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch master
in repository python-django-crispy-forms.

commit 1c49d96375e4dde6f4c880d772640ddfb1381594
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Thu Oct 27 14:16:12 2016 +0200

    Import python-django-crispy-forms_1.6.1.orig.tar.gz
---
 .github/ISSUE_TEMPLATE.md                          |  14 +++
 .travis.yml                                        |   7 ++
 CHANGELOG.md                                       |   9 ++
 CONTRIBUTORS.txt                                   |   1 +
 MANIFEST.in                                        |   2 +-
 README.rst                                         |  12 +--
 crispy_forms/__init__.py                           |   2 +-
 crispy_forms/bootstrap.py                          |   4 +-
 crispy_forms/templates/bootstrap/field.html        |   2 +-
 .../templates/bootstrap/layout/buttonholder.html   |   4 +
 .../templates/bootstrap/table_inline_formset.html  |   2 +-
 crispy_forms/templates/bootstrap3/field.html       |   2 +-
 .../bootstrap3/layout/prepended_appended_text.html |   2 +-
 .../templates/bootstrap3/table_inline_formset.html |   2 +-
 crispy_forms/templates/bootstrap4/field.html       |  12 +--
 crispy_forms/templates/bootstrap4/inputs.html      |   6 +-
 .../bootstrap4/layout/checkboxselectmultiple.html  |   2 +-
 .../layout/checkboxselectmultiple_inline.html      |   4 +-
 .../bootstrap4/layout/field_with_buttons.html      |   6 +-
 .../templates/bootstrap4/layout/formactions.html   |   6 +-
 .../templates/bootstrap4/layout/help_text.html     |   4 +-
 .../bootstrap4/layout/prepended_appended_text.html |   6 +-
 .../templates/bootstrap4/layout/radioselect.html   |   2 +-
 .../bootstrap4/layout/radioselect_inline.html      |   4 +-
 .../bootstrap4/layout/uneditable_input.html        |   6 +-
 .../templates/bootstrap4/table_inline_formset.html |   4 +-
 crispy_forms/templatetags/crispy_forms_field.py    |   2 +
 crispy_forms/templatetags/crispy_forms_tags.py     |   7 +-
 .../custom_form_template_with_context.html         |   4 +
 crispy_forms/tests/test_form_helper.py             | 104 +++++++++++++++++++--
 crispy_forms/tests/test_layout.py                  |  11 +--
 crispy_forms/tests/test_layout_objects.py          |   4 +-
 docs/_templates/sidebarintro.html                  |   2 +-
 docs/install.rst                                   |   9 +-
 setup.cfg                                          |   5 +
 tox.ini                                            |   4 +-
 36 files changed, 205 insertions(+), 74 deletions(-)

diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000..9568528
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,14 @@
+* Package version:
+* Django version:
+* Python version:
+
+### Description:
+
+// REPLACE ME: What are you trying to get done, what has happened, what went wrong, and what did you expect?
+
+### Preferably also include:
+
+-[ ] Example Django Crispy Forms code
+-[ ] Screenshots
+-[ ] Actual HTML generated
+-[ ] Exepcted HTML
diff --git a/.travis.yml b/.travis.yml
index b784294..9e5bc9b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,7 +11,10 @@ python:
 env:
   - DJANGO='django>=1.8.0,<1.9.0'
   - DJANGO='django>=1.9.0,<1.10.0'
+  - DJANGO='django>=1.10.0,<1.11.0'
   - DJANGO='https://github.com/django/django/archive/master.tar.gz'
+before_install:
+  - pip install --upgrade 'pytest<3.0.0'
 install:
   - pip install $DJANGO
   - pip install -e .
@@ -24,10 +27,14 @@ matrix:
     - python: "3.2"
       env: DJANGO='https://github.com/django/django/archive/master.tar.gz'
     - python: "3.2"
+      env: DJANGO='django>=1.10.0,<1.11.0'
+    - python: "3.2"
       env: DJANGO='django>=1.9.0,<1.10.0'
     - python: "3.3"
       env: DJANGO='https://github.com/django/django/archive/master.tar.gz'
     - python: "3.3"
+      env: DJANGO='django>=1.10.0,<1.11.0'
+    - python: "3.3"
       env: DJANGO='django>=1.9.0,<1.10.0'
     - python: "3.4"
       env: DJANGO='https://github.com/django/django/archive/master.tar.gz'
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f73e59f..219f059 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,17 @@
 # CHANGELOG for django-crispy-forms
 
+## 1.6.1 (2016/10/17)
+
+  * Updates compatibility for Django 1.10
+  * A number of small Bootstrap 4 fixes.
+
+See [1.6.1 Milestone](https://github.com/django-crispy-forms/django-crispy-forms/milestone/3?closed=1)
+for full issue list.
+
 ## 1.6.0 (2016/1/7)
 
   * Fixed compatibility with Django 1.9
+  * Dropped support for Django 1.7
   * Added Bootstrap 4 template pack
   * Other small fixes.
 
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 7d2ced0..23924ac 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -106,3 +106,4 @@ Contributors
 * John Comeau <jcomeauictx>
 * Yoong Kang Lim <yoongkang>
 * Dmitry Dygalo <Stranger6667>
+* Lee Skillen <lskillen>
diff --git a/MANIFEST.in b/MANIFEST.in
index eef8ef4..b17b18e 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -4,4 +4,4 @@ include MANIFEST.in
 include README.rst
 recursive-include crispy_forms/static *
 recursive-include crispy_forms/templates *
-recursive-include crispy_forms/tests *.py
+recursive-include crispy_forms/tests *.py *.html
diff --git a/README.rst b/README.rst
index 35e7f6e..a6c6d88 100644
--- a/README.rst
+++ b/README.rst
@@ -11,6 +11,8 @@ django-crispy-forms
 
 The best way to have Django_ DRY forms. Build programmatic reusable layouts out of components, having full control of the rendered HTML without writing HTML in templates. All this without breaking the standard way of doing things in Django, so it plays nice with any other form application.
 
+`django-crispy-forms` supports Python 2.7/Python 3.2+ and Django 1.8+
+
 The application mainly provides:
 
 * A filter named ``|crispy`` that will render elegant div based forms. Think of it as the built-in methods: ``as_table``, ``as_ul`` and ``as_p``. You cannot tune up the output, but it is easy to start using it.
@@ -20,7 +22,7 @@ Django-crispy-forms supports several frontend frameworks, such as Twitter `Boots
 
 .. _`Uni-form`: http://sprawsm.com/uni-form
 .. _`Bootstrap`: http://twitter.github.com/bootstrap/index.html
-.. _`see the docs`: http://django-crispy-forms.rtfd.org
+.. _`see the docs`: https://django-crispy-forms.readthedocs.io
 
 Authors
 =======
@@ -33,7 +35,7 @@ If you are upgrading from django-uni-form, we have `instructions`_ for helping y
 
 .. _`Daniel Greenfeld`: https://github.com/pydanny
 .. _`Miguel Araujo`: https://github.com/maraujop
-.. _`instructions`: http://django-crispy-forms.readthedocs.org/en/1.1.1/migration.html
+.. _`instructions`: https://django-crispy-forms.readthedocs.io/en/latest/install.html#moving-from-django-uni-form-to-django-crispy-forms
 
 Example
 =======
@@ -49,7 +51,7 @@ Documentation
 
 For extensive documentation see the ``docs`` folder or `read it on readthedocs`_
 
-.. _`read it on readthedocs`: http://django-crispy-forms.readthedocs.org/en/latest/index.html
+.. _`read it on readthedocs`: https://django-crispy-forms.readthedocs.io/en/latest/index.html
 
 Special thanks
 ==============
@@ -62,9 +64,5 @@ Special thanks
 .. _`@pydanny`: https://github.com/pydanny
 .. _`@kennethlove`: https://github.com/kennethlove
 
-Note
-----
-
-django-crispy-forms supports Django 1.3 or higher with Python 2.6.x, Python 2.7.x and Python 3.3.x. If you need to support Python 2.5 or Django 1.2 you will need to use a version of django-crispy-forms less than 1.3. For earlier versions of Django or Python you will need to use django-uni-form 0.7.0.
 
 .. _Django: http://djangoproject.com
diff --git a/crispy_forms/__init__.py b/crispy_forms/__init__.py
index 1fa0596..586ed4b 100644
--- a/crispy_forms/__init__.py
+++ b/crispy_forms/__init__.py
@@ -1,3 +1,3 @@
 # -*- coding: utf-8 -*-
 
-__version__ = '1.6.0'
+__version__ = '1.6.1'
diff --git a/crispy_forms/bootstrap.py b/crispy_forms/bootstrap.py
index bff16cf..3349c0d 100644
--- a/crispy_forms/bootstrap.py
+++ b/crispy_forms/bootstrap.py
@@ -36,6 +36,8 @@ class PrependedAppendedText(Field):
             'input_size': self.input_size,
             'active': getattr(self, "active", False)
         }
+        if hasattr(self, 'wrapper_class'):
+            extra_context['wrapper_class'] = self.wrapper_class
         template = self.get_template_name(template_pack)
         return render_field(
             self.field, form, form_style, context,
@@ -243,7 +245,7 @@ class ContainerHolder(Div):
         target = self.first_container_with_errors(form.errors.keys())
         if target is None:
             target = self.fields[0]
-            if not target._active_originally_included:
+            if not getattr(target, '_active_originally_included', None):
                 target.active = True
             return target
 
diff --git a/crispy_forms/templates/bootstrap/field.html b/crispy_forms/templates/bootstrap/field.html
index 491c64f..5726f5d 100644
--- a/crispy_forms/templates/bootstrap/field.html
+++ b/crispy_forms/templates/bootstrap/field.html
@@ -24,8 +24,8 @@
                     <label for="{{ field.id_for_label }}" class="checkbox {% if field.field.required %}requiredField{% endif %}">
                         {% crispy_field field %}
                         {{ field.label|safe }}
-                        {% include 'bootstrap/layout/help_text_and_errors.html' %}
                     </label>
+                    {% include 'bootstrap/layout/help_text_and_errors.html' %}
                 {% else %}
                     {% crispy_field field %}
                     {% include 'bootstrap/layout/help_text_and_errors.html' %}
diff --git a/crispy_forms/templates/bootstrap/layout/buttonholder.html b/crispy_forms/templates/bootstrap/layout/buttonholder.html
new file mode 100644
index 0000000..23a3945
--- /dev/null
+++ b/crispy_forms/templates/bootstrap/layout/buttonholder.html
@@ -0,0 +1,4 @@
+<div {% if buttonholder.css_id %}id="{{ buttonholder.css_id }}"{% endif %} 
+    class="buttonHolder{% if buttonholder.css_class %} {{ buttonholder.css_class }}{% endif %}">
+       {{ fields_output|safe }}
+</div>
diff --git a/crispy_forms/templates/bootstrap/table_inline_formset.html b/crispy_forms/templates/bootstrap/table_inline_formset.html
index 0aed75d..0be9241 100644
--- a/crispy_forms/templates/bootstrap/table_inline_formset.html
+++ b/crispy_forms/templates/bootstrap/table_inline_formset.html
@@ -38,7 +38,7 @@
 
                 <tr>
                     {% for field in form %}
-                        {% include 'bootstrap/field.html' with tag="th" form_show_labels=False %}
+                        {% include 'bootstrap/field.html' with tag="td" form_show_labels=False %}
                     {% endfor %}
                 </tr>
             {% endfor %}
diff --git a/crispy_forms/templates/bootstrap3/field.html b/crispy_forms/templates/bootstrap3/field.html
index d7f7cfa..02db7d9 100644
--- a/crispy_forms/templates/bootstrap3/field.html
+++ b/crispy_forms/templates/bootstrap3/field.html
@@ -29,8 +29,8 @@
                 <label for="{{ field.id_for_label }}" class="{% if field.field.required %} requiredField{% endif %}">
                     {% crispy_field field %}
                     {{ field.label|safe }}
-                    {% include 'bootstrap3/layout/help_text_and_errors.html' %}
                 </label>
+                {% include 'bootstrap3/layout/help_text_and_errors.html' %}
             {% else %}
                 <div class="controls {{ field_class }}">
                     {% crispy_field field %}
diff --git a/crispy_forms/templates/bootstrap3/layout/prepended_appended_text.html b/crispy_forms/templates/bootstrap3/layout/prepended_appended_text.html
index bb9148c..4129dd1 100644
--- a/crispy_forms/templates/bootstrap3/layout/prepended_appended_text.html
+++ b/crispy_forms/templates/bootstrap3/layout/prepended_appended_text.html
@@ -3,7 +3,7 @@
 {% if field.is_hidden %}
     {{ field }}
 {% else %}
-    <div id="div_{{ field.auto_id }}" class="form-group{% if form_show_errors and field.errors %} has-error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
+    <div id="div_{{ field.auto_id }}" class="form-group{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors and field.errors %} has-error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
 
         {% if field.label and form_show_labels %}
             <label for="{{ field.id_for_label }}" class="control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
diff --git a/crispy_forms/templates/bootstrap3/table_inline_formset.html b/crispy_forms/templates/bootstrap3/table_inline_formset.html
index fad02c2..df26b3a 100644
--- a/crispy_forms/templates/bootstrap3/table_inline_formset.html
+++ b/crispy_forms/templates/bootstrap3/table_inline_formset.html
@@ -38,7 +38,7 @@
 
                 <tr>
                     {% for field in form %}
-                        {% include 'bootstrap3/field.html' with tag="th" form_show_labels=False %}
+                        {% include 'bootstrap3/field.html' with tag="td" form_show_labels=False %}
                     {% endfor %}
                 </tr>
             {% endfor %}
diff --git a/crispy_forms/templates/bootstrap4/field.html b/crispy_forms/templates/bootstrap4/field.html
index 64a6593..bf2e71d 100644
--- a/crispy_forms/templates/bootstrap4/field.html
+++ b/crispy_forms/templates/bootstrap4/field.html
@@ -4,14 +4,14 @@
     {{ field }}
 {% else %}
     {% if field|is_checkbox %}
-        <div class="form-group row">
+        <div class="form-group">
         {% if label_class %}
-            <div class="controls col-{{ bootstrap_device_type }}-offset-{{ label_size }} {{ field_class }}">
+            <div class="col-{{ bootstrap_device_type }}-offset-{{ label_size }} {{ field_class }}">
         {% endif %}
     {% endif %}
-    <{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" {% if not field|is_checkbox %}class="form-group row{% else %}class="checkbox{% endif %}{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors%}{% if field.errors %} has-error{% endif %}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
+    <{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" {% if not field|is_checkbox %}class="form-group{% else %}class="checkbox{% endif %}{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors%}{% if field.errors %} has-danger{% endif %}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
         {% if field.label and not field|is_checkbox and form_show_labels %}
-            <label for="{{ field.id_for_label }}" class="control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
+            <label for="{{ field.id_for_label }}" class="form-control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
                 {{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
             </label>
         {% endif %}
@@ -29,10 +29,10 @@
                 <label for="{{ field.id_for_label }}" class="{% if field.field.required %} requiredField{% endif %}">
                     {% crispy_field field %}
                     {{ field.label|safe }}
-                    {% include 'bootstrap4/layout/help_text_and_errors.html' %}
                 </label>
+                {% include 'bootstrap4/layout/help_text_and_errors.html' %}
             {% else %}
-                <div class="controls {{ field_class }}">
+                <div class="{{ field_class }}">
                     {% crispy_field field %}
                     {% include 'bootstrap4/layout/help_text_and_errors.html' %}
                 </div>
diff --git a/crispy_forms/templates/bootstrap4/inputs.html b/crispy_forms/templates/bootstrap4/inputs.html
index 8900704..ee4e1ac 100644
--- a/crispy_forms/templates/bootstrap4/inputs.html
+++ b/crispy_forms/templates/bootstrap4/inputs.html
@@ -1,10 +1,10 @@
 {% if inputs %}
-    <div class="form-group row">
+    <div class="form-group">
         {% if label_class %}
-            <div class="aab controls {{ label_class }}"></div>
+            <div class="aab {{ label_class }}"></div>
         {% endif %}
 
-        <div class="controls {{ field_class }}">
+        <div class="{{ field_class }}">
             {% for input in inputs %}
                 {% include "bootstrap4/layout/baseinput.html" %}
             {% endfor %}
diff --git a/crispy_forms/templates/bootstrap4/layout/checkboxselectmultiple.html b/crispy_forms/templates/bootstrap4/layout/checkboxselectmultiple.html
index 557cef9..36453bd 100644
--- a/crispy_forms/templates/bootstrap4/layout/checkboxselectmultiple.html
+++ b/crispy_forms/templates/bootstrap4/layout/checkboxselectmultiple.html
@@ -1,7 +1,7 @@
 {% load crispy_forms_filters %}
 {% load l10n %}
 
-<div class="controls {{ field_class }}"{% if flat_attrs %} {{ flat_attrs|safe }}{% endif %}>
+<div class="{{ field_class }}"{% if flat_attrs %} {{ flat_attrs|safe }}{% endif %}>
     {% include 'bootstrap4/layout/field_errors_block.html' %}
 
     {% for choice in field.field.choices %}
diff --git a/crispy_forms/templates/bootstrap4/layout/checkboxselectmultiple_inline.html b/crispy_forms/templates/bootstrap4/layout/checkboxselectmultiple_inline.html
index d9a44e6..6533c4a 100644
--- a/crispy_forms/templates/bootstrap4/layout/checkboxselectmultiple_inline.html
+++ b/crispy_forms/templates/bootstrap4/layout/checkboxselectmultiple_inline.html
@@ -1,10 +1,10 @@
 {% if field.is_hidden %}
     {{ field }}
 {% else %}
-    <div id="div_{{ field.auto_id }}" class="form-group row{% if form_show_errors and field.errors %} has-error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
+    <div id="div_{{ field.auto_id }}" class="form-group{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors and field.errors %} has-danger{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
 
         {% if field.label %}
-            <label for="{{ field.auto_id }}"  class="control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
+            <label for="{{ field.auto_id }}"  class="form-control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
                 {{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
             </label>
         {% endif %}
diff --git a/crispy_forms/templates/bootstrap4/layout/field_with_buttons.html b/crispy_forms/templates/bootstrap4/layout/field_with_buttons.html
index 494e411..b13b72b 100644
--- a/crispy_forms/templates/bootstrap4/layout/field_with_buttons.html
+++ b/crispy_forms/templates/bootstrap4/layout/field_with_buttons.html
@@ -1,13 +1,13 @@
 {% load crispy_forms_field %}
 
-<div{% if div.css_id %} id="{{ div.css_id }}"{% endif %} class="form-group row{% if form_show_errors and field.errors %} has-error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}{% if div.css_class %} {{ div.css_class }}{% endif %}" {{ div.flat_attrs|safe }}>
+<div{% if div.css_id %} id="{{ div.css_id }}"{% endif %} class="form-group{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors and field.errors %} has-danger{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}{% if div.css_class %} {{ div.css_class }}{% endif %}" {{ div.flat_attrs|safe }}>
     {% if field.label and form_show_labels %}
-        <label for="{{ field.id_for_label }}" class="control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
+        <label for="{{ field.id_for_label }}" class="form-control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
             {{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
         </label>
     {% endif %}
 
-    <div class="controls {{ field_class }}">
+    <div class="{{ field_class }}">
         <div class="input-group">
             {% crispy_field field %}
             <span class="input-group-btn{% if active %} active{% endif %}{% if input_size %} {{ input_size }}{% endif %}">{{ buttons|safe }}</span>
diff --git a/crispy_forms/templates/bootstrap4/layout/formactions.html b/crispy_forms/templates/bootstrap4/layout/formactions.html
index b80aa17..6eaae48 100644
--- a/crispy_forms/templates/bootstrap4/layout/formactions.html
+++ b/crispy_forms/templates/bootstrap4/layout/formactions.html
@@ -1,9 +1,9 @@
-<div{% if formactions.attrs %} {{ formactions.flat_attrs|safe }}{% endif %} class="form-group row">
+<div{% if formactions.attrs %} {{ formactions.flat_attrs|safe }}{% endif %} class="form-group">
     {% if label_class %}
-        <div class="aab controls {{ label_class }}"></div>
+        <div class="aab {{ label_class }}"></div>
     {% endif %}
 
-    <div class="controls {{ field_class }}">
+    <div class="{{ field_class }}">
         {{ fields_output|safe }}
     </div>
 </div>
diff --git a/crispy_forms/templates/bootstrap4/layout/help_text.html b/crispy_forms/templates/bootstrap4/layout/help_text.html
index 0e2ed45..4d75f9b 100644
--- a/crispy_forms/templates/bootstrap4/layout/help_text.html
+++ b/crispy_forms/templates/bootstrap4/layout/help_text.html
@@ -1,7 +1,7 @@
 {% if field.help_text %}
     {% if help_text_inline %}
-        <span id="hint_{{ field.auto_id }}" class="help-block">{{ field.help_text|safe }}</span>
+        <span id="hint_{{ field.auto_id }}" class="text-muted">{{ field.help_text|safe }}</span>
     {% else %}
-        <p id="hint_{{ field.auto_id }}" class="help-block">{{ field.help_text|safe }}</p>
+        <small id="hint_{{ field.auto_id }}" class="text-muted">{{ field.help_text|safe }}</small>
     {% endif %}
 {% endif %}
diff --git a/crispy_forms/templates/bootstrap4/layout/prepended_appended_text.html b/crispy_forms/templates/bootstrap4/layout/prepended_appended_text.html
index e0f1171..75ec9db 100644
--- a/crispy_forms/templates/bootstrap4/layout/prepended_appended_text.html
+++ b/crispy_forms/templates/bootstrap4/layout/prepended_appended_text.html
@@ -3,15 +3,15 @@
 {% if field.is_hidden %}
     {{ field }}
 {% else %}
-    <div id="div_{{ field.auto_id }}" class="form-group row{% if form_show_errors and field.errors %} has-error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
+    <div id="div_{{ field.auto_id }}" class="form-group{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors and field.errors %} has-danger{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
 
         {% if field.label and form_show_labels %}
-            <label for="{{ field.id_for_label }}" class="control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
+            <label for="{{ field.id_for_label }}" class="form-control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
                 {{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
             </label>
         {% endif %}
 
-        <div class="controls {{ field_class }}">
+        <div class="{{ field_class }}">
             {% if field|is_select %}
                 {% if crispy_prepended_text %}<span class="input-group{% if active %} active{% endif %}{% if input_size %} {{ input_size }}{% endif %}">{{ crispy_prepended_text|safe }}</span>{% endif %}
                 {% crispy_field field %}
diff --git a/crispy_forms/templates/bootstrap4/layout/radioselect.html b/crispy_forms/templates/bootstrap4/layout/radioselect.html
index f4cefd4..2efe495 100644
--- a/crispy_forms/templates/bootstrap4/layout/radioselect.html
+++ b/crispy_forms/templates/bootstrap4/layout/radioselect.html
@@ -1,7 +1,7 @@
 {% load crispy_forms_filters %}
 {% load l10n %}
 
-<div class="controls {{ field_class }}"{% if flat_attrs %} {{ flat_attrs|safe }}{% endif %}>
+<div class="{{ field_class }}"{% if flat_attrs %} {{ flat_attrs|safe }}{% endif %}>
     {% include 'bootstrap4/layout/field_errors_block.html' %}
 
     {% for choice in field.field.choices %}
diff --git a/crispy_forms/templates/bootstrap4/layout/radioselect_inline.html b/crispy_forms/templates/bootstrap4/layout/radioselect_inline.html
index 2add9d3..a05732f 100644
--- a/crispy_forms/templates/bootstrap4/layout/radioselect_inline.html
+++ b/crispy_forms/templates/bootstrap4/layout/radioselect_inline.html
@@ -1,10 +1,10 @@
 {% if field.is_hidden %}
     {{ field }}
 {% else %}
-    <div id="div_{{ field.auto_id }}" class="form-group row{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors and field.errors %} has-error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
+    <div id="div_{{ field.auto_id }}" class="form-group{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors and field.errors %} has-danger{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
 
         {% if field.label %}
-            <label for="{{ field.auto_id }}"  class="control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
+            <label for="{{ field.auto_id }}"  class="form-control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
                 {{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
             </label>
         {% endif %}
diff --git a/crispy_forms/templates/bootstrap4/layout/uneditable_input.html b/crispy_forms/templates/bootstrap4/layout/uneditable_input.html
index d5fdf2d..f84d993 100644
--- a/crispy_forms/templates/bootstrap4/layout/uneditable_input.html
+++ b/crispy_forms/templates/bootstrap4/layout/uneditable_input.html
@@ -1,9 +1,9 @@
 {% load crispy_forms_field %}
 
 
-<div id="div_{{ field.auto_id }}" class="form-group row{% if form_show_errors and field.errors %} error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
-    <label class="control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}</label>
-    <div class="controls {{ field_class }}">
+<div id="div_{{ field.auto_id }}" class="form-group{% if form_show_errors and field.errors %} error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
+    <label class="form-control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}</label>
+    <div class="{{ field_class }}">
         {% crispy_field field 'disabled' 'disabled' %}
         {% include 'bootstrap4/layout/help_text.html' %}
     </div>
diff --git a/crispy_forms/templates/bootstrap4/table_inline_formset.html b/crispy_forms/templates/bootstrap4/table_inline_formset.html
index 6e55e96..b129a8c 100644
--- a/crispy_forms/templates/bootstrap4/table_inline_formset.html
+++ b/crispy_forms/templates/bootstrap4/table_inline_formset.html
@@ -21,7 +21,7 @@
                 <tr>
                     {% for field in formset.forms.0 %}
                         {% if field.label and not field|is_checkbox and not field.is_hidden %}
-                            <th for="{{ field.auto_id }}" class="control-label {% if field.field.required %}requiredField{% endif %}">
+                            <th for="{{ field.auto_id }}" class="form-control-label {% if field.field.required %}requiredField{% endif %}">
                                 {{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
                             </th>
                         {% endif %}
@@ -38,7 +38,7 @@
 
                 <tr>
                     {% for field in form %}
-                        {% include 'bootstrap4/field.html' with tag="th" form_show_labels=False %}
+                        {% include 'bootstrap4/field.html' with tag="td" form_show_labels=False %}
                     {% endfor %}
                 </tr>
             {% endfor %}
diff --git a/crispy_forms/templatetags/crispy_forms_field.py b/crispy_forms/templatetags/crispy_forms_field.py
index 238e99d..be3a33d 100644
--- a/crispy_forms/templatetags/crispy_forms_field.py
+++ b/crispy_forms/templatetags/crispy_forms_field.py
@@ -120,6 +120,8 @@ class CrispyFieldNode(template.Node):
                 and not is_file(field)
             ):
                 css_class += ' form-control'
+                if field.errors:
+                    css_class += ' form-control-danger'
 
             widget.attrs['class'] = css_class
 
diff --git a/crispy_forms/templatetags/crispy_forms_tags.py b/crispy_forms/templatetags/crispy_forms_tags.py
index 74ed13d..ce0239b 100644
--- a/crispy_forms/templatetags/crispy_forms_tags.py
+++ b/crispy_forms/templatetags/crispy_forms_tags.py
@@ -126,6 +126,7 @@ class BasicNode(template.Node):
         response_dict = self.get_response_dict(helper, context, is_formset)
         node_context = copy_context(context)
         node_context.update(response_dict)
+        final_context = copy_context(node_context)
 
         # If we have a helper's layout we use it, for the form or the formset's forms
         if helper and helper.layout:
@@ -140,11 +141,11 @@ class BasicNode(template.Node):
                     forloop.iterate()
 
         if is_formset:
-            response_dict.update({'formset': actual_form})
+            final_context['formset'] = actual_form
         else:
-            response_dict.update({'form': actual_form})
+            final_context['form'] = actual_form
 
-        return Context(response_dict)
+        return final_context
 
     def get_response_dict(self, helper, context, is_formset):
         """
diff --git a/crispy_forms/tests/templates/custom_form_template_with_context.html b/crispy_forms/tests/templates/custom_form_template_with_context.html
new file mode 100644
index 0000000..2378296
--- /dev/null
+++ b/crispy_forms/tests/templates/custom_form_template_with_context.html
@@ -0,0 +1,4 @@
+<h1>Special custom form with context passthrough</h1>
+Got prefix: {{ prefix }}.
+{% include "bootstrap/whole_uni_form.html" %}
+Got suffix: {{ suffix }}.
diff --git a/crispy_forms/tests/test_form_helper.py b/crispy_forms/tests/test_form_helper.py
index 97ce9be..f1b9b27 100644
--- a/crispy_forms/tests/test_form_helper.py
+++ b/crispy_forms/tests/test_form_helper.py
@@ -7,7 +7,10 @@ import django
 from django import forms
 from django.core.urlresolvers import reverse
 from django.forms.models import formset_factory
-from django.middleware.csrf import _get_new_csrf_key
+try:
+    from django.middleware.csrf import _get_new_csrf_key
+except ImportError:
+    from django.middleware.csrf import _get_new_csrf_string as _get_new_csrf_key
 from django.template import (
     TemplateSyntaxError, Context
 )
@@ -148,7 +151,11 @@ def test_html5_required():
     form.helper.html5_required = True
     html = render_crispy_form(form)
     # 6 out of 7 fields are required and an extra one for the SplitDateTimeWidget makes 7.
-    assert html.count('required="required"') == 7
+    if django.VERSION < (1, 10):
+        assert html.count('required="required"') == 7
+    else:
+        assert len(re.findall(r'\brequired\b', html)) == 7
+
 
     form = TestForm()
     form.helper = FormHelper()
@@ -540,7 +547,7 @@ def test_multifield_errors():
     assert html.count('error') == 0
 
 
- at only_bootstrap
+ at only_bootstrap3
 def test_bootstrap_form_show_errors():
     form = TestForm({
         'email': 'invalidemail',
@@ -568,6 +575,34 @@ def test_bootstrap_form_show_errors():
     assert html.count('error') == 0
 
 
+ at only_bootstrap4
+def test_bootstrap_form_show_errors():
+    form = TestForm({
+        'email': 'invalidemail',
+        'first_name': 'first_name_too_long',
+        'last_name': 'last_name_too_long',
+        'password1': 'yes',
+        'password2': 'yes',
+    })
+    form.helper = FormHelper()
+    form.helper.layout = Layout(
+        AppendedText('email', 'whatever'),
+        PrependedText('first_name', 'blabla'),
+        PrependedAppendedText('last_name', 'foo', 'bar'),
+        AppendedText('password1', 'whatever'),
+        PrependedText('password2', 'blabla'),
+    )
+    form.is_valid()
+
+    form.helper.form_show_errors = True
+    html = render_crispy_form(form)
+    assert html.count('error') == 3
+
+    form.helper.form_show_errors = False
+    html = render_crispy_form(form)
+    assert html.count('error') == 0
+
+
 @only_bootstrap
 def test_error_text_inline(settings):
     form = TestForm({'email': 'invalidemail'})
@@ -600,7 +635,7 @@ def test_error_text_inline(settings):
     assert len(matches) == 3
 
 
- at only_bootstrap
+ at only_bootstrap3
 def test_error_and_help_inline():
     form = TestForm({'email': 'invalidemail'})
     form.helper = FormHelper()
@@ -630,6 +665,36 @@ def test_error_and_help_inline():
     assert error_position < help_position
 
 
+ at only_bootstrap4
+def test_error_and_help_inline():
+    form = TestForm({'email': 'invalidemail'})
+    form.helper = FormHelper()
+    form.helper.error_text_inline = False
+    form.helper.help_text_inline = True
+    form.helper.layout = Layout('email')
+    form.is_valid()
+    html = render_crispy_form(form)
+
+    # Check that help goes before error, otherwise CSS won't work
+    help_position = html.find('<span id="hint_id_email" class="help-inline">')
+    error_position = html.find('<p id="error_1_id_email" class="help-block">')
+    assert help_position < error_position
+
+    # Viceversa
+    form = TestForm({'email': 'invalidemail'})
+    form.helper = FormHelper()
+    form.helper.error_text_inline = True
+    form.helper.help_text_inline = False
+    form.helper.layout = Layout('email')
+    form.is_valid()
+    html = render_crispy_form(form)
+
+    # Check that error goes before help, otherwise CSS won't work
+    error_position = html.find('<span id="error_1_id_email" class="help-inline">')
+    help_position = html.find('<small id="hint_id_email" class="text-muted">')
+    assert error_position < help_position
+
+
 @only_bootstrap
 def test_form_show_labels():
     form = TestForm()
@@ -690,31 +755,50 @@ def test_template_pack():
 
 
 @only_bootstrap4
-def test_bootstrap4_label_class_and_field_class():
+def test_label_class_and_field_class():
     form = TestForm()
     form.helper = FormHelper()
     form.helper.label_class = 'col-lg-2'
     form.helper.field_class = 'col-lg-8'
     html = render_crispy_form(form)
 
-    assert '<div class="form-group row">' in html
-    assert '<div class="controls col-lg-offset-2 col-lg-8">' in html
+    assert '<div class="form-group">' in html
+    assert '<div class="col-lg-offset-2 col-lg-8">' in html
     assert html.count('col-lg-8') == 7
 
     form.helper.label_class = 'col-sm-3'
     form.helper.field_class = 'col-sm-8'
     html = render_crispy_form(form)
 
-    assert '<div class="form-group row">' in html
-    assert '<div class="controls col-sm-offset-3 col-sm-8">' in html
+    assert '<div class="form-group">' in html
+    assert '<div class="col-sm-offset-3 col-sm-8">' in html
     assert html.count('col-sm-8') == 7
 
 
 @only_bootstrap4
-def test_bootstrap4_template_pack():
+def test_template_pack():
     form = TestForm()
     form.helper = FormHelper()
     form.helper.template_pack = 'uni_form'
     html = render_crispy_form(form)
     assert 'form-control' not in html
     assert 'ctrlHolder' in html
+
+
+def test_passthrough_context():
+    """
+    Test to ensure that context is passed through implicitly from outside of
+    the crispy form into the crispy form templates.
+    """
+    form = TestForm()
+    form.helper = FormHelper()
+    form.helper.template = 'custom_form_template_with_context.html'
+
+    c = {
+        'prefix': 'foo',
+        'suffix': 'bar'
+    }
+
+    html = render_crispy_form(form, helper=form.helper, context=c)
+    assert "Got prefix: foo" in html
+    assert "Got suffix: bar" in html
diff --git a/crispy_forms/tests/test_layout.py b/crispy_forms/tests/test_layout.py
index 090ee21..9163e79 100644
--- a/crispy_forms/tests/test_layout.py
+++ b/crispy_forms/tests/test_layout.py
@@ -4,7 +4,10 @@ from __future__ import unicode_literals
 from django import forms
 from django.core.urlresolvers import reverse
 from django.forms.models import formset_factory, modelformset_factory
-from django.middleware.csrf import _get_new_csrf_key
+try:
+    from django.middleware.csrf import _get_new_csrf_key
+except ImportError:
+    from django.middleware.csrf import _get_new_csrf_string as _get_new_csrf_key
 from django.shortcuts import render_to_response
 from django.template import (
     Context, RequestContext
@@ -300,8 +303,6 @@ def test_formset_layout(settings):
     assert html.count('Note for first form only') == 1
     if settings.CRISPY_TEMPLATE_PACK == 'uni_form':
         assert html.count('formRow') == 3
-    elif settings.CRISPY_TEMPLATE_PACK == 'bootstrap4':
-        assert html.count('row') == 21
     else:
         assert html.count('row') == 3
 
@@ -537,9 +538,7 @@ def test_keepcontext_context_manager(settings):
         InlineCheckboxes('alphacheckboxes'),
         'numeric_multiple_checkboxes'
     )
-    request_factory = RequestFactory()
-    request = request_factory.get('/')
-    context = RequestContext(request, {'form': form})
+    context = {'form': form}
 
     response = render_to_response('crispy_render_template.html', context)
 
diff --git a/crispy_forms/tests/test_layout_objects.py b/crispy_forms/tests/test_layout_objects.py
index 42a0408..5698ce8 100644
--- a/crispy_forms/tests/test_layout_objects.py
+++ b/crispy_forms/tests/test_layout_objects.py
@@ -98,7 +98,7 @@ def test_field_wrapper_class(settings):
     elif settings.CRISPY_TEMPLATE_PACK == 'bootstrap3':
         assert html.count('class="form-group testing"') == 1
     elif settings.CRISPY_TEMPLATE_PACK == 'bootstrap4':
-        assert html.count('class="form-group row testing"') == 1
+        assert html.count('class="form-group testing"') == 1
 
 
 def test_html_with_carriage_returns(settings):
@@ -400,7 +400,7 @@ class TestBootstrapLayoutObjects(object):
         if settings.CRISPY_TEMPLATE_PACK == 'bootstrap3':
             form_group_class = 'form-group'
         elif settings.CRISPY_TEMPLATE_PACK == 'bootstrap4':
-            form_group_class = 'form-group row'
+            form_group_class = 'form-group'
 
         assert html.count('class="%s extra"' % form_group_class) == 1
         assert html.count('autocomplete="off"') == 1
diff --git a/docs/_templates/sidebarintro.html b/docs/_templates/sidebarintro.html
index 11f654e..625b333 100644
--- a/docs/_templates/sidebarintro.html
+++ b/docs/_templates/sidebarintro.html
@@ -14,7 +14,7 @@
     If you love django-crispy-forms, consider making a small donation <a href="http://flattr.com/thing/512037/django-crispy-forms">on Flattr</a>:
 </p>
 <p>
-    <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://django-crispy-forms.rtfd.org"></a>
+    <a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="https://django-crispy-forms.readthedocs.io"></a>
     <noscript><a href="http://flattr.com/thing/512037/django-crispy-forms" target="_blank">
     <img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Click to flattr django-crispy-forms" border="0" /></a></noscript>
 </p>
diff --git a/docs/install.rst b/docs/install.rst
index 6081954..b2209c6 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -39,8 +39,9 @@ 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.
 * ``bootstrap3`` Twitter Bootstrap version 3.
+* ``bootstrap4`` Alpha support for Twitter Bootstrap version 4, which is still in Alpha.
 * ``uni-form`` `Uni-form`_ is a nice looking, well structured, highly customizable, accessible and usable forms.
-* ``foundation`` `Foundation`_ In creators 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`_
 
 If your form CSS framework is not supported and it's open source, you can create a template pack for it and submit a pull request in Github or create a ``crispy-forms-templatePackName`` project and let me know, so I can link it.
 
@@ -57,7 +58,7 @@ Please check the documentation of your template pack package for the correct val
 Setting media files
 ~~~~~~~~~~~~~~~~~~~
 
-crispy-forms no longer includes static files. You will need to include yourself the proper corresponding media files, depending on what CSS framework (Template pack) you are using. This might involve one or more CSS and JS files. Read CSS framework's docs for help on how to set it up.
+crispy-forms no longer includes static files. You will need to include the proper corresponding media files yourself depending on what CSS framework (Template pack) you are using. This might involve one or more CSS and JS files. Read CSS framework's docs for help on how to set it up.
 
 Moving from django-uni-form to django-crispy-forms
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -71,7 +72,7 @@ django-crispy-forms was started as a friendly fork of django-uni-form. We are aw
     from uni_form.helper import FormHelper
     from crispy_forms.helper import FormHelper
 
-In Linux You can use `rpl`_ to easily find and update the proper lines. Run in the root of your project the following command. It is strongly recommended that you have your project in a VCS or a backup, so you can rollback if something goes wrong::
+In Linux You can use `rpl`_ to easily find and update the proper lines. In the root of your project run the following command. It is strongly recommended that you have your project in a VCS or a backup, so you can rollback if something goes wrong::
 
     rpl -R uni_form. crispy_forms. .
 
@@ -100,7 +101,7 @@ Using rpl::
     rpl -R "|as_uni_errors" "|as_crispy_errors" .
     rpl -R "|as_uni_field" "|as_crispy_field" .
 
-There is one filter that has been turned into a tag for extra layout power, so former filter name will not work. You will only need to update this if you have custom or overridden templates in your project::
+There is one filter that has been turned into a tag for extra layout power, so the former filter name will not work. You will only need to update this if you have custom or overridden templates in your project::
 
     field|with_class ------> {% crispy_field field %}
 
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..f1c66dc
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,5 @@
+[metadata]
+license-file = LICENSE.txt
+
+[wheel]
+universal=1
diff --git a/tox.ini b/tox.ini
index b2784ef..397687c 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,13 +1,13 @@
 [tox]
 envlist =
     {py27,py32,py33,py34,py35}-django18
-    {py27,py34,py35}-{django19,django-latest}
+    {py27,py34,py35}-{django19,django110,django-latest}
 
 [testenv]
 deps =
-    django17: django>=1.7.0,<1.8.0
     django18: django>=1.8.0,<1.9.0
     django19: django>=1.9.0,<1.10.0
+    django110: django>=1.10.0,<1.11.0
     django-latest: https://github.com/django/django/archive/master.tar.gz
 whitelist_externals = make
 commands = make test

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-django-crispy-forms.git



More information about the Python-modules-commits mailing list