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