+
+
+class BlogGalleryUrlSerializer(PlainSerializer):
+ class Meta:
+ model = Photo
+ fields = ['image']
+
+
+class BlogSerializer(serializers.ModelSerializer):
+ url = AbsoluteURLField()
+ image_url = serializers.FileField(source='image')
+ image_thumb = ThumbnailField('193x193', source='image')
+ key = serializers.DateTimeField(source='first_published_at')
+ gallery_urls = BlogGalleryUrlSerializer(many=True, source='photo_set')
+ body = serializers.CharField()
+ lead = serializers.CharField()
+
+ class Meta:
+ model = Entry
+ fields = ['title', 'lead', 'body', 'place', 'time', 'image_url', 'image_thumb',
+ 'gallery_urls', 'type', 'key', 'url']