Skip to content
Snippets Groups Projects

Fix pizza api serializers and viewsets

Merged Ghost User requested to merge fix/pizza-api into master
2 files
+ 6
3
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -37,7 +37,8 @@ class OrderSerializer(serializers.ModelSerializer):
read_only_fields = ('pk', 'payment', 'name', 'member')
payment = PaymentTypeField(source='payment.type',
choices=Payment.PAYMENT_TYPE)
choices=Payment.PAYMENT_TYPE,
read_only=True)
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']
instance.payment.save()
del validated_data['payment']
if 'payment' in validated_data:
del validated_data['payment']
return super().update(instance, validated_data)
Loading