From: Jan Szejko Date: Thu, 23 Aug 2018 15:04:07 +0000 (+0200) Subject: premium info in user data api X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/b4883c8bdcf7d97a20271a25546f39992448f56a?ds=sidebyside;hp=f99929a3fa250a4d39388013b990334ae1f7c779 premium info in user data api --- diff --git a/src/api/handlers.py b/src/api/handlers.py index d050f0fac..0814fd4c4 100644 --- a/src/api/handlers.py +++ b/src/api/handlers.py @@ -669,14 +669,14 @@ class PictureHandler(BaseHandler): class UserDataHandler(BaseHandler): model = BookUserData - fields = ('state', 'username') + fields = ('state', 'username', 'premium') allowed_methods = ('GET', 'POST') def read(self, request, slug=None): if not request.user.is_authenticated(): return rc.FORBIDDEN if slug is None: - return {'username': request.user.username} + return {'username': request.user.username, 'premium': is_subscribed(request.user)} try: book = Book.objects.get(slug=slug) except Book.DoesNotExist: