Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add templatetag for address formatting
Artur Smęt9c151f2f552d
diff --git a/saleor/i18n_address_forms/templatetags/__init__.py b/saleor/i18n_address_forms/templatetags/__init__.pynew file mode 100644index 0000000000..8b13789179--- /dev/null+++ b/saleor/i18n_address_forms/templatetags/__init__.py@@ -0,0 +1 @@+diff --git a/saleor/i18n_address_forms/templatetags/i18n_address_tags.py b/saleor/i18n_address_forms/templatetags/i18n_address_tags.pynew file mode 100644index 0000000000..151ec5c592--- /dev/null+++ b/saleor/i18n_address_forms/templatetags/i18n_address_tags.py@@ -0,0 +1,13 @@+from django import template+import i18naddress+from django.utils.safestring import mark_safe+from ...userprofile.models import Address++register = template.Library()+++def format_address(address, latin=False):+ address_data = Address.objects.as_data(address)+ address_data['country_code'] = address_data['country']+ return mark_safe(i18naddress.format_address(address_data, latin))