1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django.contrib.auth.models import User
6 from rest_framework import serializers
7 from .fields import UserPremiumField, AbsoluteURLField, ThumbnailField
8 from .models import BookUserData
11 class PlainSerializer(serializers.ModelSerializer):
12 def to_representation(self, value):
13 value = super(PlainSerializer, self).to_representation(value)
14 return value.values()[0]
17 class UserSerializer(serializers.ModelSerializer):
18 premium = UserPremiumField()
22 fields = ['username', 'premium']
25 class BookUserDataSerializer(serializers.ModelSerializer):