Django-NotesApp/project/notes/serializers.py

11 lines
308 B
Python
Raw Normal View History

2023-02-24 00:13:44 +08:00
from rest_framework import serializers
from .models import Note
class NoteSerializer(serializers.HyperlinkedModelSerializer):
owner = serializers.ReadOnlyField(source='owner.username')
2023-02-24 00:13:44 +08:00
class Meta:
model = Note
fields = ('id', 'title', 'content', 'date_created', 'owner')