Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Convert the price field to bootstrap
Patryk Zawadzki640a71ffd4d3
diff --git a/saleor/core/widgets.py b/saleor/core/widgets.pyindex 8b13789179..96ebb81da9 100644--- a/saleor/core/widgets.py+++ b/saleor/core/widgets.py@@ -1 +1,16 @@+from django.utils.html import escape+from django.utils.safestring import mark_safe+from django_prices.widgets import PriceInput as BasePriceInput++class PriceInput(BasePriceInput):+ TEMPLATE = '''<div class="input-group">+ %(widget)s+ <div class="input-group-addon">%(currency)s</div>+</div>'''++ def render(self, name, value, attrs=None):+ widget = super(BasePriceInput, self).render(name, value, attrs)+ result = self.TEMPLATE % {'widget': widget,+ 'currency': escape(self.currency)}+ return mark_safe(result)diff --git a/saleor/dashboard/product/forms.py b/saleor/dashboard/product/forms.pyindex 1bc8905ed9..8ee78315c6 100644--- a/saleor/dashboard/product/forms.py+++ b/saleor/dashboard/product/forms.py@@ -4,14 +4,13 @@ from django import formsfrom django.forms.models import inlineformset_factoryfrom django.forms.widgets import ClearableFileInput+from ...core.widgets import PriceInputfrom ...product.models import (ProductImage, Product, ShirtVariant, BagVariant,Shirt, Bag)-PRODUCT_CLASSES = {'shirt': Shirt,- 'bag': Bag-}+ 'bag': Bag}class ProductClassForm(forms.Form):@@ -29,12 +28,14 @@ class ShirtForm(ProductForm):class Meta:model = Shirtexclude = []+ widgets = {'price': PriceInput}class BagForm(ProductForm):class Meta:model = Bagexclude = []+ widgets = {'price': PriceInput}class ImageInputWidget(ClearableFileInput):