You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
463 B
16 lines
463 B
2 years ago
|
from rest_framework import serializers
|
||
|
from user_info.serializers import UserDescSerializer
|
||
|
from comment.models import Comment
|
||
|
|
||
|
|
||
|
class CommentSerializer(serializers.ModelSerializer):
|
||
|
"""评论的序列化器"""
|
||
|
url = serializers.HyperlinkedIdentityField(view_name='comment-detail')
|
||
|
author = UserDescSerializer(read_only=True)
|
||
|
|
||
|
class Meta:
|
||
|
model = Comment
|
||
|
fields = '__all__'
|
||
|
extra_kwargs = {'created': {'read_only': True}}
|
||
|
|