DRF_Template/backend/notifications/serializers.py

13 lines
385 B
Python
Raw Normal View History

from rest_framework import serializers
from notifications.models import Notification
class NotificationSerializer(serializers.ModelSerializer):
timestamp = serializers.DateTimeField(
format="%m-%d-%Y %I:%M %p", read_only=True)
class Meta:
model = Notification
fields = '__all__'
read_only_fields = ('id', 'recipient', 'content', 'timestamp')