Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Methods for price range formatting
Artur Smęt45d12c7ac2bf
diff --git a/saleor/product/models/base_products.py b/saleor/product/models/base_products.pyindex c423fcc5f3..2a4d9d0e97 100644--- a/saleor/product/models/base_products.py+++ b/saleor/product/models/base_products.py@@ -68,4 +68,21 @@ class Product(Subtyped, ItemRange):collection__isnull=False)def __iter__(self):- return iter(self.variants.all())\ No newline at end of file+ return iter(self.variants.all())++ def get_formatted_price(self, price):+ return "{0} {1}".format(price.gross, price.currency)++ def admin_get_price_min(self):+ price = self.get_price_range().min_price+ return self.get_formatted_price(price)+ admin_get_price_min.short_description = pgettext_lazy(+ 'Product admin page', 'Minimal price'+ )++ def admin_get_price_max(self):+ price = self.get_price_range().max_price+ return self.get_formatted_price(price)+ admin_get_price_max.short_description = pgettext_lazy(+ 'Product admin page', 'Maximal price'+ )\ No newline at end of file