Skip to content

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

Add self.currency to PriceRangeWidget

michal6f0416c13c35
diff --git a/saleor/dashboard/widgets.py b/saleor/dashboard/widgets.py
index 51e7a4e762..455d5eaafe 100644
--- a/saleor/dashboard/widgets.py
+++ b/saleor/dashboard/widgets.py
@@ -14,6 +14,6 @@ class DateRangeWidget(RangeWidget):
class PriceRangeWidget(RangeWidget):
def __init__(self, attrs=None):
- currency = getattr(settings, 'DEFAULT_CURRENCY')
- widgets = (PriceInput(currency), PriceInput(currency))
+ self.currency = getattr(settings, 'DEFAULT_CURRENCY')
+ widgets = (PriceInput(self.currency), PriceInput(self.currency))
super(RangeWidget, self).__init__(widgets, attrs)
diff --git a/templates/materializecssform/field.html b/templates/materializecssform/field.html
index ebe4895895..5380a0a32c 100644
--- a/templates/materializecssform/field.html
+++ b/templates/materializecssform/field.html
@@ -290,6 +290,10 @@
{% endif %}
</label>
{% for value in field.value %}
+ <input type="number" class="col s3"
+ name="{{ field.name }}_{{ forloop.counter0 }}" value="{{ value }}"
+ id="{{ field.auto_id }}_{{ forloop.counter0 }}">
+ <span class="currency">{{ field.field.widget.currency }}</span>
{% for error in field.errors %}
<p class="help-block materialize-red-text">
{{ error }}
@@ -300,9 +304,6 @@
{{ field.help_text|safe }}
</p>
{% endif %}
- <input type="number" class="col s5"
- name="{{ field.name }}_{{ forloop.counter0 }}" value="{{ value }}"
- id="{{ field.auto_id }}_{{ forloop.counter0 }}">
{% if not forloop.last %}
<div class="col s2 center-align separator">-</div>
{% endif %}