Created
March 24, 2016 02:42
-
-
Save yevgnenll/b8a03c7eb8b125bcc578 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from posts.models import Post | |
from rest_framework import serializers | |
class PostDetailSerializer(serializers.HyperlinkedModelSerializer): | |
username = serializers.CharField(source="user.username") | |
class Meta: | |
model = Post | |
fields = ( | |
'title', | |
'username', | |
'content', | |
'created_at', | |
'updated_at', | |
'is_public', | |
'comment', | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment