fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f99929a
)
premium info in user data api
author
Jan Szejko
<janek37@gmail.com>
Thu, 23 Aug 2018 15:04:07 +0000
(17:04 +0200)
committer
Jan Szejko
<janek37@gmail.com>
Thu, 23 Aug 2018 15:04:07 +0000
(17:04 +0200)
src/api/handlers.py
patch
|
blob
|
history
diff --git
a/src/api/handlers.py
b/src/api/handlers.py
index
d050f0f
..
0814fd4
100644
(file)
--- a/
src/api/handlers.py
+++ b/
src/api/handlers.py
@@
-669,14
+669,14
@@
class PictureHandler(BaseHandler):
class UserDataHandler(BaseHandler):
model = BookUserData
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:
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:
try:
book = Book.objects.get(slug=slug)
except Book.DoesNotExist: