Skip to content

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

Inherit PhonePrefixWidget from its storefront version

dominik-zeglenca4c50d519a5
diff --git a/saleor/dashboard/widgets.py b/saleor/dashboard/widgets.py
index 02795b4e25..59360fb2e2 100644
--- a/saleor/dashboard/widgets.py
+++ b/saleor/dashboard/widgets.py
@@ -2,14 +2,9 @@ from django import forms
from django.conf import settings
from django_filters.widgets import RangeWidget
from django_prices.widgets import PriceInput
-from django.forms import Select, TextInput
-from phonenumber_field.widgets import PhoneNumberPrefixWidget
-from phonenumbers import COUNTRY_CODE_TO_REGION_CODE
-
-phone_prefixes = [
- ('+{}'.format(k), '+{}'.format(k)) for
- (k, v) in sorted(COUNTRY_CODE_TO_REGION_CODE.items())]
+from ..userprofile.widgets import (PhonePrefixWidget as
+ StorefrontPhonePrefixWidget)
class DateRangeWidget(RangeWidget):
@@ -25,15 +20,5 @@ class PriceRangeWidget(RangeWidget):
super(RangeWidget, self).__init__(widgets, attrs)
-class PhonePrefixWidget(PhoneNumberPrefixWidget):
- """
- Overwrite widget to use choices with tuple in a simple form of "+XYZ: +XYZ"
- Workaround for an issue:
- https://github.com/stefanfoulis/django-phonenumber-field/issues/82
- """
-
+class PhonePrefixWidget(StorefrontPhonePrefixWidget):
template_name = 'dashboard/order/widget/phone-prefix-widget.html'
-
- def __init__(self, attrs=None):
- widgets = (Select(attrs=attrs, choices=phone_prefixes), TextInput())
- super(PhoneNumberPrefixWidget, self).__init__(widgets, attrs)