Django-NotesApp/project/notes/serializers.py

10 lines
308 B
Python

from rest_framework import serializers
from .models import Note
class NoteSerializer(serializers.HyperlinkedModelSerializer):
owner = serializers.ReadOnlyField(source='owner.username')
class Meta:
model = Note
fields = ('id', 'title', 'content', 'date_created', 'owner')