MrB4RC0D3

MaterialSerializer

May 29th, 2024
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | Source Code | 0 0
  1. class MaterialSerializer(ModelSerializer):
  2.     id = serializers.IntegerField(source='material.id')
  3.     name = serializers.CharField(source='material.name')
  4.  
  5.     class Meta:
  6.         model = Material
  7.         fields = ('id', 'name', 'amount', 'amountType', 'link', 'status')
  8.         extra_kwargs = {'id': {'read_only': True}}
  9.  
Advertisement
Add Comment
Please, Sign In to add comment