Skip to content

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

Make country required

Pacu21d5ada91f378
diff --git a/saleor/graphql/account/types.py b/saleor/graphql/account/types.py
index b0bd97b4b4..70416a1825 100644
--- a/saleor/graphql/account/types.py
+++ b/saleor/graphql/account/types.py
@@ -25,7 +25,7 @@ class AddressInput(graphene.InputObjectType):
class Address(CountableDjangoObjectType):
country = graphene.Field(
- CountryDisplay, description='Default shop\'s country')
+ CountryDisplay, required=True, description='Default shop\'s country')
class Meta:
exclude_fields = ['user_set', 'user_addresses']
@@ -34,10 +34,8 @@ class Address(CountableDjangoObjectType):
model = models.Address
def resolve_country(self, info):
- if self.country:
- return CountryDisplay(
- code=self.country.code, country=self.country.name)
- return None
+ return CountryDisplay(
+ code=self.country.code, country=self.country.name)
class User(CountableDjangoObjectType):
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index b5b8133aec..287404622f 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -13,7 +13,7 @@ type Address implements Node {
city: String!
cityArea: String!
postalCode: String!
- country: CountryDisplay
+ country: CountryDisplay!
countryArea: String!
phone: String
}
diff --git a/saleor/static/dashboard-next/orders/types/AddressFragment.ts b/saleor/static/dashboard-next/orders/types/AddressFragment.ts
index f0ad292e04..145eac914d 100644
--- a/saleor/static/dashboard-next/orders/types/AddressFragment.ts
+++ b/saleor/static/dashboard-next/orders/types/AddressFragment.ts
@@ -17,7 +17,7 @@ export interface AddressFragment {
city: string;
cityArea: string;
companyName: string;
- country: AddressFragment_country | null;
+ country: AddressFragment_country;
countryArea: string;
firstName: string;
lastName: string;
diff --git a/saleor/static/dashboard-next/orders/types/OrderCancel.ts b/saleor/static/dashboard-next/orders/types/OrderCancel.ts
index bb52953b0f..61fbecf798 100644
--- a/saleor/static/dashboard-next/orders/types/OrderCancel.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderCancel.ts
@@ -19,7 +19,7 @@ export interface OrderCancel_orderCancel_order_billingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderCancel_orderCancel_order_billingAddress_country | null;
+ country: OrderCancel_orderCancel_order_billingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
@@ -129,7 +129,7 @@ export interface OrderCancel_orderCancel_order_shippingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderCancel_orderCancel_order_shippingAddress_country | null;
+ country: OrderCancel_orderCancel_order_shippingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
diff --git a/saleor/static/dashboard-next/orders/types/OrderCapture.ts b/saleor/static/dashboard-next/orders/types/OrderCapture.ts
index 0eca21d736..b57bfce077 100644
--- a/saleor/static/dashboard-next/orders/types/OrderCapture.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderCapture.ts
@@ -25,7 +25,7 @@ export interface OrderCapture_orderCapture_order_billingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderCapture_orderCapture_order_billingAddress_country | null;
+ country: OrderCapture_orderCapture_order_billingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
@@ -135,7 +135,7 @@ export interface OrderCapture_orderCapture_order_shippingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderCapture_orderCapture_order_shippingAddress_country | null;
+ country: OrderCapture_orderCapture_order_shippingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
diff --git a/saleor/static/dashboard-next/orders/types/OrderDetails.ts b/saleor/static/dashboard-next/orders/types/OrderDetails.ts
index 78d4fb9efa..014d1470d6 100644
--- a/saleor/static/dashboard-next/orders/types/OrderDetails.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderDetails.ts
@@ -19,7 +19,7 @@ export interface OrderDetails_order_billingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderDetails_order_billingAddress_country | null;
+ country: OrderDetails_order_billingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
@@ -129,7 +129,7 @@ export interface OrderDetails_order_shippingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderDetails_order_shippingAddress_country | null;
+ country: OrderDetails_order_shippingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
diff --git a/saleor/static/dashboard-next/orders/types/OrderDetailsFragment.ts b/saleor/static/dashboard-next/orders/types/OrderDetailsFragment.ts
index 00a6ad9712..468860209d 100644
--- a/saleor/static/dashboard-next/orders/types/OrderDetailsFragment.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderDetailsFragment.ts
@@ -19,7 +19,7 @@ export interface OrderDetailsFragment_billingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderDetailsFragment_billingAddress_country | null;
+ country: OrderDetailsFragment_billingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
@@ -129,7 +129,7 @@ export interface OrderDetailsFragment_shippingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderDetailsFragment_shippingAddress_country | null;
+ country: OrderDetailsFragment_shippingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
diff --git a/saleor/static/dashboard-next/orders/types/OrderDraftUpdate.ts b/saleor/static/dashboard-next/orders/types/OrderDraftUpdate.ts
index 4c252b93d3..f7bcb1dd01 100644
--- a/saleor/static/dashboard-next/orders/types/OrderDraftUpdate.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderDraftUpdate.ts
@@ -25,7 +25,7 @@ export interface OrderDraftUpdate_draftOrderUpdate_order_billingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderDraftUpdate_draftOrderUpdate_order_billingAddress_country | null;
+ country: OrderDraftUpdate_draftOrderUpdate_order_billingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
@@ -135,7 +135,7 @@ export interface OrderDraftUpdate_draftOrderUpdate_order_shippingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderDraftUpdate_draftOrderUpdate_order_shippingAddress_country | null;
+ country: OrderDraftUpdate_draftOrderUpdate_order_shippingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
diff --git a/saleor/static/dashboard-next/orders/types/OrderLineAdd.ts b/saleor/static/dashboard-next/orders/types/OrderLineAdd.ts
index 3280f8a13b..d723a152a1 100644
--- a/saleor/static/dashboard-next/orders/types/OrderLineAdd.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderLineAdd.ts
@@ -25,7 +25,7 @@ export interface OrderLineAdd_draftOrderLineCreate_order_billingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderLineAdd_draftOrderLineCreate_order_billingAddress_country | null;
+ country: OrderLineAdd_draftOrderLineCreate_order_billingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
@@ -135,7 +135,7 @@ export interface OrderLineAdd_draftOrderLineCreate_order_shippingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderLineAdd_draftOrderLineCreate_order_shippingAddress_country | null;
+ country: OrderLineAdd_draftOrderLineCreate_order_shippingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
diff --git a/saleor/static/dashboard-next/orders/types/OrderLineDelete.ts b/saleor/static/dashboard-next/orders/types/OrderLineDelete.ts
index 29daa81c71..c7231c61e1 100644
--- a/saleor/static/dashboard-next/orders/types/OrderLineDelete.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderLineDelete.ts
@@ -25,7 +25,7 @@ export interface OrderLineDelete_draftOrderLineDelete_order_billingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderLineDelete_draftOrderLineDelete_order_billingAddress_country | null;
+ country: OrderLineDelete_draftOrderLineDelete_order_billingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
@@ -135,7 +135,7 @@ export interface OrderLineDelete_draftOrderLineDelete_order_shippingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderLineDelete_draftOrderLineDelete_order_shippingAddress_country | null;
+ country: OrderLineDelete_draftOrderLineDelete_order_shippingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
diff --git a/saleor/static/dashboard-next/orders/types/OrderLineUpdate.ts b/saleor/static/dashboard-next/orders/types/OrderLineUpdate.ts
index ec6b653496..a9d30c0393 100644
--- a/saleor/static/dashboard-next/orders/types/OrderLineUpdate.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderLineUpdate.ts
@@ -25,7 +25,7 @@ export interface OrderLineUpdate_draftOrderLineUpdate_order_billingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderLineUpdate_draftOrderLineUpdate_order_billingAddress_country | null;
+ country: OrderLineUpdate_draftOrderLineUpdate_order_billingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
@@ -135,7 +135,7 @@ export interface OrderLineUpdate_draftOrderLineUpdate_order_shippingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderLineUpdate_draftOrderLineUpdate_order_shippingAddress_country | null;
+ country: OrderLineUpdate_draftOrderLineUpdate_order_shippingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
diff --git a/saleor/static/dashboard-next/orders/types/OrderRefund.ts b/saleor/static/dashboard-next/orders/types/OrderRefund.ts
index 25c13980a4..79cb2a1ddf 100644
--- a/saleor/static/dashboard-next/orders/types/OrderRefund.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderRefund.ts
@@ -25,7 +25,7 @@ export interface OrderRefund_orderRefund_order_billingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderRefund_orderRefund_order_billingAddress_country | null;
+ country: OrderRefund_orderRefund_order_billingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
@@ -135,7 +135,7 @@ export interface OrderRefund_orderRefund_order_shippingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderRefund_orderRefund_order_shippingAddress_country | null;
+ country: OrderRefund_orderRefund_order_shippingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
diff --git a/saleor/static/dashboard-next/orders/types/OrderRelease.ts b/saleor/static/dashboard-next/orders/types/OrderRelease.ts
index 7768fe4d41..178a719274 100644
--- a/saleor/static/dashboard-next/orders/types/OrderRelease.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderRelease.ts
@@ -19,7 +19,7 @@ export interface OrderRelease_orderRelease_order_billingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderRelease_orderRelease_order_billingAddress_country | null;
+ country: OrderRelease_orderRelease_order_billingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
@@ -129,7 +129,7 @@ export interface OrderRelease_orderRelease_order_shippingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderRelease_orderRelease_order_shippingAddress_country | null;
+ country: OrderRelease_orderRelease_order_shippingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
diff --git a/saleor/static/dashboard-next/orders/types/OrderUpdate.ts b/saleor/static/dashboard-next/orders/types/OrderUpdate.ts
index f4282e7715..46266b7ae7 100644
--- a/saleor/static/dashboard-next/orders/types/OrderUpdate.ts
+++ b/saleor/static/dashboard-next/orders/types/OrderUpdate.ts
@@ -25,7 +25,7 @@ export interface OrderUpdate_orderUpdate_order_billingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderUpdate_orderUpdate_order_billingAddress_country | null;
+ country: OrderUpdate_orderUpdate_order_billingAddress_country;
countryArea: string;
firstName: string;
lastName: string;
@@ -47,7 +47,7 @@ export interface OrderUpdate_orderUpdate_order_shippingAddress {
city: string;
cityArea: string;
companyName: string;
- country: OrderUpdate_orderUpdate_order_shippingAddress_country | null;
+ country: OrderUpdate_orderUpdate_order_shippingAddress_country;
countryArea: string;
firstName: string;
lastName: string;