-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathserializers.py
36 lines (26 loc) · 1.12 KB
/
serializers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from rest_framework import serializers
from authors.models import single_author, Followers
from post.models import Post, Comment
import uuid
class AuthorSerializer(serializers.ModelSerializer):
type = serializers.CharField(default='author', max_length=10)
class Meta:
model = single_author
fields = ('type','id','url','host','github','profileImage','username')
class PostsSerializer(serializers.ModelSerializer):
type = serializers.CharField(max_length=10,default='posts')
class Meta:
model = Post
fields = ('uuid','type','title','id','source','description','contentType','content','author','Categories','count','origin','published','visibility','unlisted')
class ImagePostsSerializer(serializers.ModelSerializer):
class Meta:
model = Post
fields = ('post_image',)
class commentSerializer(serializers.ModelSerializer):
class Meta:
model = Comment
fields = ('uuid','type','author','comment','contentType','published','id')
# class followSerializer(serializers.ModelSerializer):
# class Meta:
# model = Followers
# fields = 'all'