blob: daef52e81569c9b6bace8a2533ef4d569e437568 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
from rest_framework import serializers
from taggit_serializer.serializers import TagListSerializerField, TaggitSerializer
from .models import Note, Notebook
class NoteSerializer(TaggitSerializer, serializers.ModelSerializer):
tags = TagListSerializerField()
class Meta:
model = Note
fields = ('title', 'body_text', 'body_qjson', 'body_html', 'url', 'notebook', 'tags')
class NotebookSerializer(serializers.HyperlinkedModelSerializer):
json_absolute_url = serializers.URLField(source='get_absolute_url', read_only=True)
class Meta:
model = Notebook
fields = ('name', 'json_absolute_url')
|