We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fa08302 commit ed49971Copy full SHA for ed49971
1 file changed
blog/serializers.py
@@ -2,7 +2,8 @@
2
from blog.models import Post, Category
3
4
class PostSerializer(serializers.ModelSerializer):
5
- author_name = serializers.CharField(source='author.username', read_only=True)
+ author_first_name = serializers.CharField(source='author.first_name', read_only=True)
6
+ author_last_name = serializers.CharField(source='author.last_name', read_only=True)
7
category_names = serializers.SlugRelatedField(
8
many=True,
9
read_only=True,
@@ -22,7 +23,8 @@ class Meta:
22
23
'image',
24
'file',
25
'author',
- 'author_name',
26
+ 'author_first_name',
27
+ 'author_last_name',
28
'categories',
29
'category_names'
30
]
0 commit comments