Skip to content

Commit

Permalink
Change the fields on the serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
viggo-devries committed Oct 30, 2024
1 parent e1b0845 commit 842acf6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions oscarapi/serializers/admin/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 2 additions & 4 deletions oscarapi/serializers/checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 842acf6

Please sign in to comment.