From 7770ce15ed6a4768044c7f91a9ab4cd323832546 Mon Sep 17 00:00:00 2001 From: Daniel Roy Greenfeld Date: Mon, 5 Oct 2015 10:55:08 -0700 Subject: [PATCH] Adds Bootstrap 4 classes as crispy-forms override #365 --- .../templates/bootstrap3/field.html | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/bootstrap3/field.html diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/bootstrap3/field.html b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/bootstrap3/field.html new file mode 100644 index 000000000..a469b988e --- /dev/null +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/templates/bootstrap3/field.html @@ -0,0 +1,48 @@ +{% load crispy_forms_field %} + +{% if field.is_hidden %} + {{ field }} +{% else %} + {% if field|is_checkbox %} +
+ {% if label_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 field.label and not field|is_checkbox and form_show_labels %} + + {% endif %} + + {% if field|is_checkboxselectmultiple %} + {% include 'bootstrap3/layout/checkboxselectmultiple.html' %} + {% endif %} + + {% if field|is_radioselect %} + {% include 'bootstrap3/layout/radioselect.html' %} + {% endif %} + + {% if not field|is_checkboxselectmultiple and not field|is_radioselect %} + {% if field|is_checkbox and form_show_labels %} + + {% else %} +
+ {% crispy_field field %} + {% include 'bootstrap3/layout/help_text_and_errors.html' %} +
+ {% endif %} + {% endif %} + + {% if field|is_checkbox %} + {% if label_class %} +
+ {% endif %} +
+ {% endif %} +{% endif %}