from django.contrib.auth.models import User
from fluent_contents.rendering import render_placeholder
from rest_framework import serializers
from apps.bluebottle_drf2.serializers import SorlImageField
from .models import BlogPost


class BlogPostAuthorSerializer(serializers.ModelSerializer):
    picture = SorlImageField('userprofile.picture', '90x90', crop='center', colorspace='GRAY')

    class Meta:
        model = User
        fields = ('id', 'first_name', 'last_name', 'picture')


class BlogPostContentsField(serializers.Field):

    def to_native(self, obj):
        request = self.context.get('request', None)
        contents_html = render_placeholder(request, obj)
        return contents_html


class BlogPostDetailSerializer(serializers.ModelSerializer):
    contents = BlogPostContentsField(source='contents')
    url = serializers.HyperlinkedIdentityField(view_name='blogpost-instance')
    main_image = SorlImageField('main_image', '300x200', crop='center')
    author = BlogPostAuthorSerializer()
    class Meta:
        model = BlogPost
        exclude = ('id',)


class BlogPostPreviewSerializer(BlogPostDetailSerializer):

    class Meta:
        model = BlogPost
        exclude = ('id',)

@@ -1,48 +1,4 @@
-from django.contrib.auth.models import User%0A
 from
@@ -148,16 +148,34 @@
 ageField
+, AuthorSerializer
 %0Afrom .m
@@ -199,266 +199,8 @@
 Post
-%0A%0A%0Aclass BlogPostAuthorSerializer(serializers.ModelSerializer):%0A    picture = SorlImageField('userprofile.picture', '90x90', crop='center', colorspace='GRAY')%0A%0A    class Meta:%0A        model = User%0A        fields = ('id', 'first_name', 'last_name', 'picture')
 %0A%0A%0Ac
@@ -697,24 +697,16 @@
 uthor = 
-BlogPost
 AuthorSe
@@ -716,16 +716,17 @@
 lizer()%0A
+%0A
     clas

Use AuthorSerializer in BlogPostSerializer.