mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
API: fix event creation sales-channel-migration (#4949)
* API: fix event creation sales-channel-migration * do not allow sales_channels to be None * fix wrong validation error-key
This commit is contained in:
committed by
GitHub
parent
06efb37d5d
commit
a903cfa4d1
@@ -81,6 +81,13 @@ class SalesChannelMigrationMixin:
|
||||
|
||||
def to_internal_value(self, data):
|
||||
if "sales_channels" in data:
|
||||
if data["sales_channels"] is None:
|
||||
raise ValidationError({
|
||||
"sales_channels": [
|
||||
"The legacy attribute 'sales_channels' cannot be set to None, it must be a list."
|
||||
]
|
||||
})
|
||||
|
||||
prefetch_related_objects([self.organizer], "sales_channels")
|
||||
all_channels = {
|
||||
s.identifier for s in
|
||||
@@ -89,7 +96,7 @@ class SalesChannelMigrationMixin:
|
||||
|
||||
if data.get("all_sales_channels") and set(data["sales_channels"]) != all_channels:
|
||||
raise ValidationError({
|
||||
"limit_sales_channels": [
|
||||
"all_sales_channels": [
|
||||
"If 'all_sales_channels' is set, the legacy attribute 'sales_channels' must not be set or set to "
|
||||
"the list of all sales channels."
|
||||
]
|
||||
@@ -109,6 +116,7 @@ class SalesChannelMigrationMixin:
|
||||
else:
|
||||
data["all_sales_channels"] = False
|
||||
data["limit_sales_channels"] = data["sales_channels"]
|
||||
|
||||
del data["sales_channels"]
|
||||
|
||||
if data.get("all_sales_channels"):
|
||||
|
||||
Reference in New Issue
Block a user