fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
minor changes in paypal
[wolnelektury.git]
/
src
/
api
/
handlers.py
diff --git
a/src/api/handlers.py
b/src/api/handlers.py
index
3e4e093
..
ab1a44a
100644
(file)
--- a/
src/api/handlers.py
+++ b/
src/api/handlers.py
@@
-656,16
+656,18
@@
class PictureHandler(BaseHandler):
class UserDataHandler(BaseHandler):
model = BookUserData
class UserDataHandler(BaseHandler):
model = BookUserData
- fields = ('state',)
+ fields = ('state',
'username'
)
allowed_methods = ('GET', 'POST')
allowed_methods = ('GET', 'POST')
- def read(self, request, slug):
+ def read(self, request, slug=None):
+ if not request.user.is_authenticated():
+ return rc.FORBIDDEN
+ if slug is None:
+ return {'username': request.user.username}
try:
book = Book.objects.get(slug=slug)
except Book.DoesNotExist:
return rc.NOT_FOUND
try:
book = Book.objects.get(slug=slug)
except Book.DoesNotExist:
return rc.NOT_FOUND
- if not request.user.is_authenticated():
- return rc.FORBIDDEN
try:
data = BookUserData.objects.get(book=book, user=request.user)
except BookUserData.DoesNotExist:
try:
data = BookUserData.objects.get(book=book, user=request.user)
except BookUserData.DoesNotExist: