fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
432f225
)
thumbnails in blog api
author
Jan Szejko
<janek37@gmail.com>
Tue, 21 Aug 2018 14:02:24 +0000
(16:02 +0200)
committer
Jan Szejko
<janek37@gmail.com>
Tue, 21 Aug 2018 14:02:24 +0000
(16:02 +0200)
src/api/handlers.py
patch
|
blob
|
history
diff --git
a/src/api/handlers.py
b/src/api/handlers.py
index
0ace9a7
..
d050f0f
100644
(file)
--- a/
src/api/handlers.py
+++ b/
src/api/handlers.py
@@
-762,7
+762,7
@@
class UserLikeHandler(BaseHandler):
class BlogEntryHandler(BaseHandler):
model = Entry
class BlogEntryHandler(BaseHandler):
model = Entry
- fields = ('title', 'lead', 'body', 'place', 'time', 'image_url', 'gallery_urls', 'type', 'key')
+ fields = ('title', 'lead', 'body', 'place', 'time', 'image_url', '
image_thumb', '
gallery_urls', 'type', 'key')
def read(self, request):
after = request.GET.get('after')
def read(self, request):
after = request.GET.get('after')
@@
-778,6
+778,11
@@
class BlogEntryHandler(BaseHandler):
def image_url(cls, entry):
return (WL_BASE + entry.image.url) if entry.image else None
def image_url(cls, entry):
return (WL_BASE + entry.image.url) if entry.image else None
+ @classmethod
+ def image_thumb(cls, entry):
+ return MEDIA_BASE + default.backend.get_thumbnail(
+ entry.image, "193x193").url if entry.image else ''
+
@classmethod
def gallery_urls(cls, entry):
return [WL_BASE + photo.url() for photo in entry.photo_set.all()]
@classmethod
def gallery_urls(cls, entry):
return [WL_BASE + photo.url() for photo in entry.photo_set.all()]