2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +00:00

List API now uses the thumbnail image

This commit is contained in:
Oliver Walters
2020-04-05 00:19:37 +11:00
parent afa31b3415
commit 0cfb293ca9
5 changed files with 30 additions and 8 deletions

View File

@ -337,7 +337,17 @@ class StockList(generics.ListCreateAPIView):
locations = {}
for item in data:
item['part__image'] = os.path.join(settings.MEDIA_URL, item['part__image'])
img = item['part__image']
# Use the thumbnail image instead
fn, ext = os.path.splitext(img)
thumb = "{fn}.thumbnail{ext}".format(fn=fn, ext=ext)
item['part__thumbnail'] = os.path.join(settings.MEDIA_URL, thumb)
del item['part__image']
loc_id = item['location']