From 842acf69a0b44c0b3f071d664579a1c0f67f7f05 Mon Sep 17 00:00:00 2001 From: Viggo de Vries Date: Wed, 30 Oct 2024 11:27:55 +0100 Subject: [PATCH] Change the fields on the serializer --- oscarapi/serializers/admin/order.py | 4 +--- oscarapi/serializers/checkout.py | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/oscarapi/serializers/admin/order.py b/oscarapi/serializers/admin/order.py index 89e5d3b5..bc4438fe 100644 --- a/oscarapi/serializers/admin/order.py +++ b/oscarapi/serializers/admin/order.py @@ -22,6 +22,4 @@ class AdminOrderLineAttributeSerializer(OrderLineAttributeSerializer): class AdminOrderLineSerializer(OrderLineSerializer): url = serializers.HyperlinkedIdentityField(view_name="admin-order-lines-detail") - attributes = AdminOrderLineAttributeSerializer( - many=True, fields=("url", "option", "value"), required=False - ) + attributes = AdminOrderLineAttributeSerializer(many=True, required=False) diff --git a/oscarapi/serializers/checkout.py b/oscarapi/serializers/checkout.py index 3b4f6280..59cf9273 100644 --- a/oscarapi/serializers/checkout.py +++ b/oscarapi/serializers/checkout.py @@ -118,16 +118,14 @@ class OrderLineAttributeSerializer(OscarHyperlinkedModelSerializer): class Meta: model = OrderLineAttribute - fields = "__all__" + fields = ["url", "option", "value"] class OrderLineSerializer(OscarHyperlinkedModelSerializer): "This serializer renames some fields so they match up with the basket" url = serializers.HyperlinkedIdentityField(view_name="order-lines-detail") - attributes = OrderLineAttributeSerializer( - many=True, fields=("url", "option", "value"), required=False - ) + attributes = OrderLineAttributeSerializer(many=True, required=False) price_currency = serializers.CharField(source="order.currency", max_length=12) price_excl_tax = serializers.DecimalField( decimal_places=2, max_digits=12, source="line_price_excl_tax"