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