Hey there! This problem might be a bit unpredictable, but give it a go and let us know how you do!
How can you complete the serializer for an order that includes multiple order items and calculates the total price?Serializers in DRF
Summing up shopping sprees, byte by byte
Report a typo
Fill in the gaps with the relevant elements
():
class Meta:
model = OrderItem
fields = ['product', 'quantity', 'price']
class OrderSerializer(serializers.ModelSerializer):
= ()
total_price = serializers.SerializerMethodField()
def get_total_price(self, obj):
()Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.