Skip to content

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

Move ajax select2 fields to dashboard code

Anna Siwik777f1439b071
diff --git a/saleor/dashboard/discount/forms.py b/saleor/dashboard/discount/forms.py
index 2dee739cb5..a2b1382f07 100644
--- a/saleor/dashboard/discount/forms.py
+++ b/saleor/dashboard/discount/forms.py
@@ -6,12 +6,12 @@ from django.urls import reverse_lazy
from django.utils.translation import pgettext_lazy
from django_prices.forms import PriceField
-from ...core.forms import (
- AjaxSelect2ChoiceField, AjaxSelect2MultipleChoiceField)
from ...discount import DiscountValueType, VoucherApplyToProduct
from ...discount.models import Sale, Voucher
from ...product.models import Product
from ...shipping.models import ShippingMethodCountry, COUNTRY_CODE_CHOICES
+from ..forms import (
+ AjaxSelect2ChoiceField, AjaxSelect2MultipleChoiceField)
class SaleForm(forms.ModelForm):
diff --git a/saleor/core/forms.py b/saleor/dashboard/forms.py
similarity index 98%
rename from saleor/core/forms.py
rename to saleor/dashboard/forms.py
index d493c6db7e..4df7a96f32 100644
--- a/saleor/core/forms.py
+++ b/saleor/dashboard/forms.py
@@ -1,6 +1,7 @@
import json
from django import forms
+from django.core.exceptions import ValidationError
class AjaxSelect2ChoiceField(forms.ChoiceField):
diff --git a/saleor/dashboard/order/forms.py b/saleor/dashboard/order/forms.py
index 0c18ec5eda..6007d291fc 100644
--- a/saleor/dashboard/order/forms.py
+++ b/saleor/dashboard/order/forms.py
@@ -7,9 +7,7 @@ from django_prices.forms import PriceField
from payments import PaymentError, PaymentStatus
from satchless.item import InsufficientStock
-from ..widgets import PhonePrefixWidget
from ...cart.forms import QuantityField
-from ...core.forms import AjaxSelect2ChoiceField
from ...discount.utils import decrease_voucher_usage
from ...order import GroupStatus
from ...order.models import DeliveryGroup, OrderLine, OrderNote
@@ -19,8 +17,10 @@ from ...order.utils import (
recalculate_order, remove_empty_groups)
from ...product.models import Product, ProductVariant, Stock
from ...product.utils import allocate_stock, deallocate_stock
-from ...userprofile.i18n import (AddressForm as StorefrontAddressForm,
- PossiblePhoneNumberFormField)
+from ...userprofile.i18n import (
+ AddressForm as StorefrontAddressForm, PossiblePhoneNumberFormField)
+from ..forms import AjaxSelect2ChoiceField
+from ..widgets import PhonePrefixWidget
class OrderNoteForm(forms.ModelForm):