mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2024-11-17 04:09:25 +08:00
12 lines
385 B
Python
12 lines
385 B
Python
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')
|