mirror of
https://github.com/lemeow125/Ivy-Backend.git
synced 2024-11-17 06:39:26 +08:00
Add id in serializer
This commit is contained in:
parent
96ab7ed1d4
commit
c486b12f33
1 changed files with 2 additions and 1 deletions
|
@ -5,8 +5,9 @@ from .models import Product
|
||||||
class ProductSerializer(serializers.HyperlinkedModelSerializer):
|
class ProductSerializer(serializers.HyperlinkedModelSerializer):
|
||||||
date_added = serializers.DateTimeField(
|
date_added = serializers.DateTimeField(
|
||||||
format="%d-%m-%Y %I:%M%p", read_only=True)
|
format="%d-%m-%Y %I:%M%p", read_only=True)
|
||||||
|
quantity = serializers.IntegerField(required=False, default=0)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Product
|
model = Product
|
||||||
fields = ('name', 'quantity', 'date_added')
|
fields = ('id', 'name', 'quantity', 'date_added')
|
||||||
read_only_fields = ('id', 'date_added')
|
read_only_fields = ('id', 'date_added')
|
||||||
|
|
Loading…
Reference in a new issue