mirror of
https://github.com/pretix/pretix.git
synced 2026-09-15 16:34:42 +00:00
Fix API serializer for auto_checkin_rules to accept sales channel identifiers (Z#23170095) (#4579)
* Fix API serializer for auto_checkin_rules to accept sales channel identifiers instead of PKs * False -> false in json
This commit is contained in:
@@ -71,7 +71,7 @@ Endpoints
|
|||||||
"mode": "placed",
|
"mode": "placed",
|
||||||
"all_sales_channels": false,
|
"all_sales_channels": false,
|
||||||
"limit_sales_channels": ["web"],
|
"limit_sales_channels": ["web"],
|
||||||
"all_products": False,
|
"all_products": false,
|
||||||
"limit_products": [2, 3],
|
"limit_products": [2, 3],
|
||||||
"limit_variations": [456],
|
"limit_variations": [456],
|
||||||
"all_payment_methods": true,
|
"all_payment_methods": true,
|
||||||
@@ -113,7 +113,7 @@ Endpoints
|
|||||||
"mode": "placed",
|
"mode": "placed",
|
||||||
"all_sales_channels": false,
|
"all_sales_channels": false,
|
||||||
"limit_sales_channels": ["web"],
|
"limit_sales_channels": ["web"],
|
||||||
"all_products": False,
|
"all_products": false,
|
||||||
"limit_products": [2, 3],
|
"limit_products": [2, 3],
|
||||||
"limit_variations": [456],
|
"limit_variations": [456],
|
||||||
"all_payment_methods": true,
|
"all_payment_methods": true,
|
||||||
@@ -146,7 +146,7 @@ Endpoints
|
|||||||
"mode": "placed",
|
"mode": "placed",
|
||||||
"all_sales_channels": false,
|
"all_sales_channels": false,
|
||||||
"limit_sales_channels": ["web"],
|
"limit_sales_channels": ["web"],
|
||||||
"all_products": False,
|
"all_products": false,
|
||||||
"limit_products": [2, 3],
|
"limit_products": [2, 3],
|
||||||
"limit_variations": [456],
|
"limit_variations": [456],
|
||||||
"all_payment_methods": true,
|
"all_payment_methods": true,
|
||||||
@@ -167,7 +167,7 @@ Endpoints
|
|||||||
"mode": "placed",
|
"mode": "placed",
|
||||||
"all_sales_channels": false,
|
"all_sales_channels": false,
|
||||||
"limit_sales_channels": ["web"],
|
"limit_sales_channels": ["web"],
|
||||||
"all_products": False,
|
"all_products": false,
|
||||||
"limit_products": [2, 3],
|
"limit_products": [2, 3],
|
||||||
"limit_variations": [456],
|
"limit_variations": [456],
|
||||||
"all_payment_methods": true,
|
"all_payment_methods": true,
|
||||||
@@ -216,7 +216,7 @@ Endpoints
|
|||||||
"mode": "placed",
|
"mode": "placed",
|
||||||
"all_sales_channels": false,
|
"all_sales_channels": false,
|
||||||
"limit_sales_channels": ["web"],
|
"limit_sales_channels": ["web"],
|
||||||
"all_products": False,
|
"all_products": false,
|
||||||
"limit_products": [2, 3],
|
"limit_products": [2, 3],
|
||||||
"limit_variations": [456],
|
"limit_variations": [456],
|
||||||
"all_payment_methods": true,
|
"all_payment_methods": true,
|
||||||
|
|||||||
@@ -25,12 +25,19 @@ from rest_framework import serializers, viewsets
|
|||||||
|
|
||||||
from pretix.api.pagination import TotalOrderingFilter
|
from pretix.api.pagination import TotalOrderingFilter
|
||||||
from pretix.api.serializers.i18n import I18nAwareModelSerializer
|
from pretix.api.serializers.i18n import I18nAwareModelSerializer
|
||||||
from pretix.base.models import ItemVariation
|
from pretix.base.models import ItemVariation, SalesChannel
|
||||||
from pretix.plugins.autocheckin.models import AutoCheckinRule
|
from pretix.plugins.autocheckin.models import AutoCheckinRule
|
||||||
from pretix.plugins.sendmail.models import Rule
|
from pretix.plugins.sendmail.models import Rule
|
||||||
|
|
||||||
|
|
||||||
class AutoCheckinRuleSerializer(I18nAwareModelSerializer):
|
class AutoCheckinRuleSerializer(I18nAwareModelSerializer):
|
||||||
|
limit_sales_channels = serializers.SlugRelatedField(
|
||||||
|
slug_field="identifier",
|
||||||
|
queryset=SalesChannel.objects.none(),
|
||||||
|
required=False,
|
||||||
|
allow_empty=True,
|
||||||
|
many=True,
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = AutoCheckinRule
|
model = AutoCheckinRule
|
||||||
|
|||||||
Reference in New Issue
Block a user