Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add multiwidgets handling for bootstrap 3

Michał Ociepka47cabf11b81f
diff --git a/saleor/core/templates/bootstrap/_field_horizontal.html b/saleor/core/templates/bootstrap/_field_horizontal.html
index 837ee2388b..3c2b9a3c6a 100644
--- a/saleor/core/templates/bootstrap/_field_horizontal.html
+++ b/saleor/core/templates/bootstrap/_field_horizontal.html
@@ -26,6 +26,11 @@
{% endif %}
{% endfor %}
{% endif %}
+ {% if input_type == "multi_widget" %}
+ <div class="row">
+ {% render_widget bound_field class="form-control" %}
+ </div>
+ {% endif %}
{% if bound_field.help_text %}
<span class="help-block">{{ bound_field.help_text }}</span>
diff --git a/saleor/core/templates/bootstrap/_field_vertical.html b/saleor/core/templates/bootstrap/_field_vertical.html
index daf2d1ac33..b4f91635f3 100644
--- a/saleor/core/templates/bootstrap/_field_vertical.html
+++ b/saleor/core/templates/bootstrap/_field_vertical.html
@@ -26,6 +26,11 @@
{% endif %}
{% endfor %}
{% endif %}
+ {% if input_type == "multi_widget" %}
+ <div class="row">
+ {% render_widget bound_field class="form-control" %}
+ </div>
+ {% endif %}
{% if bound_field.help_text %}
<span class="help-block">{{ bound_field.help_text }}</span>
diff --git a/saleor/core/templatetags/bootstrap.py b/saleor/core/templatetags/bootstrap.py
index 154a7d47e1..f9d280ad46 100644
--- a/saleor/core/templatetags/bootstrap.py
+++ b/saleor/core/templatetags/bootstrap.py
@@ -30,6 +30,8 @@ def render_field(bound_field, show_label, template):
input_type = 'textarea'
elif isinstance(widget, forms.CheckboxInput):
input_type = 'checkbox'
+ elif issubclass(type(widget), forms.MultiWidget):
+ input_type = 'multi_widget'
else:
input_type = 'input'