From a1bea0df5f091d145b44babb3a8df3fe15073c39 Mon Sep 17 00:00:00 2001 From: Mads Nylund Date: Tue, 19 Sep 2023 15:10:10 +0200 Subject: [PATCH] altered orderlistserializer --- app/content/views/user.py | 6 ++++-- app/payment/serializers/order.py | 12 +++--------- app/payment/views/__init__.py | 2 +- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/app/content/views/user.py b/app/content/views/user.py index 24b4cbd62..a0a7c6f82 100644 --- a/app/content/views/user.py +++ b/app/content/views/user.py @@ -285,12 +285,14 @@ def get_user_events(self, request, *args, **kwargs): return self.paginate_response( data=events, serializer=EventListSerializer, context={"request": request} ) - + @action(detail=False, methods=["get"], url_path="me/payment_orders") def get_user_payment_orders(self, request, *args, **kwargs): payment_orders = request.user.orders.all() return self.paginate_response( - data=payment_orders, serializer=OrderListSerializer, context={"request": request} + data=payment_orders, + serializer=OrderListSerializer, + context={"request": request}, ) @action(detail=False, methods=["get"], url_path="me/forms") diff --git a/app/payment/serializers/order.py b/app/payment/serializers/order.py index a92369b2f..b2441f100 100644 --- a/app/payment/serializers/order.py +++ b/app/payment/serializers/order.py @@ -32,20 +32,14 @@ def create(self, validated_data): class OrderEventListSerializer(BaseModelSerializer): - class Meta: model = Event - fields = ( - "title", - ) + fields = ("title",) + class OrderListSerializer(BaseModelSerializer): event = OrderEventListSerializer(read_only=True) class Meta: model = Order - fields = ( - "status", - "user", - "event" - ) \ No newline at end of file + fields = ("order_id", "status", "payment_link", "user", "event") diff --git a/app/payment/views/__init__.py b/app/payment/views/__init__.py index 04ba37027..761f46a67 100644 --- a/app/payment/views/__init__.py +++ b/app/payment/views/__init__.py @@ -1 +1 @@ -from app.payment.views.order import Order, OrderListSerializer \ No newline at end of file +from app.payment.views.order import Order, OrderListSerializer