X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/80d3980873a2c07121f466c187de92be1cea8415..e78ad9088340bcceb6634334ce0941f571a67440:/apps/api/handlers.py diff --git a/apps/api/handlers.py b/apps/api/handlers.py index 76de8c6a3..706e0cdac 100644 --- a/apps/api/handlers.py +++ b/apps/api/handlers.py @@ -66,9 +66,9 @@ class CatalogueHandler(BaseHandler): elif field in ('mp3', 'ogg', 'daisy'): media = [] - for m in book.medias.filter(type=''): - files.append({ - 'url': m.file.get_absolute_url(), + for m in book.media.filter(type=field): + media.append({ + 'url': m.file.url, 'size': m.file.size, }) if media: @@ -83,6 +83,9 @@ class CatalogueHandler(BaseHandler): elif field == 'author': obj[field] = ", ".join(t.name for t in book.tags.filter(category='author')) + elif field == 'parent': + obj[field] = book.parent_id + elif field in ('license', 'license_description', 'source_name', 'technical_editors', 'editors'): f = extra_info.get(field)