Ivy-Backend/ivy/products/serializers.py
2023-03-05 21:56:48 +08:00

12 lines
382 B
Python

from rest_framework import serializers
from .models import Product
class ProductSerializer(serializers.HyperlinkedModelSerializer):
date_added = serializers.DateTimeField(
format="%d-%m-%Y %I:%M%p", read_only=True)
class Meta:
model = Product
fields = ('name', 'quantity', 'date_added')
read_only_fields = ('id', 'date_added')