Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Improve readability of code
Adam Bogdal4a6713f45fcd
diff --git a/saleor/product/models/base.py b/saleor/product/models/base.pyindex 9f8a068286..baf97783ee 100644--- a/saleor/product/models/base.py+++ b/saleor/product/models/base.py@@ -1,10 +1,9 @@from __future__ import unicode_literals-import refrom django.core.urlresolvers import reverse-from django.utils.encoding import python_2_unicode_compatible+from django.utils.encoding import python_2_unicode_compatible, smart_textfrom django.db import models-from django.utils.safestring import mark_safe+from django.utils.text import slugifyfrom django.utils.translation import pgettext_lazyfrom model_utils.managers import InheritanceManagerfrom mptt.models import MPTTModel@@ -69,9 +68,7 @@ class Product(models.Model, ItemRange):'product_id': self.id})def get_slug(self):- value = unidecode(self.name)- value = re.sub(r'[^\w\s-]', '', value).strip().lower()- return mark_safe(re.sub(r'[-\s]+', '-', value))+ return slugify(smart_text(unidecode(self.name)))def get_formatted_price(self, price):return "{0} {1}".format(price.gross, price.currency)