Commit 104213bb authored by Luko van der Maas's avatar Luko van der Maas Committed by Sébastiaan Versteeg
Browse files

Merge branch 'fix/pizza-api' into 'master'

Fix pizza api serializers and viewsets

See merge request !1278

(cherry picked from commit a8e7167f)

ca6bba41 Fix pizza api serializers and viewsets
parent 17972e45
......@@ -37,7 +37,8 @@ class OrderSerializer(serializers.ModelSerializer):
read_only_fields = ('pk', 'payment', 'name', 'member')
payment = PaymentTypeField(source='payment.type',
class AdminOrderSerializer(serializers.ModelSerializer):
......@@ -64,5 +65,6 @@ class AdminOrderSerializer(serializers.ModelSerializer):
).get('type', instance.payment.type) != instance.payment.type:
instance.payment.type = validated_data['payment']['type']
del validated_data['payment']
if 'payment' in validated_data:
del validated_data['payment']
return super().update(instance, validated_data)
......@@ -8,6 +8,7 @@ from rest_framework.mixins import ListModelMixin
from rest_framework.response import Response
from rest_framework.viewsets import GenericViewSet, ModelViewSet
from payments.models import Payment
from pizzas.api import serializers
from pizzas.models import Product, PizzaEvent, Order
from import can_change_order
......@@ -54,7 +55,7 @@ class OrderViewset(ModelViewSet):
return Order.objects.none()
return Order.objects.filter(member=self.request.member,
return Order.objects.filter(member=self.request.member,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment