mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #697 from SchrodingersGat/stock-api-fix
Stock api fix
This commit is contained in:
commit
fce26c80b7
@ -225,11 +225,17 @@ class PartList(generics.ListCreateAPIView):
|
|||||||
|
|
||||||
# Use the 'thumbnail' image here instead of the full-size image
|
# Use the 'thumbnail' image here instead of the full-size image
|
||||||
# Note: The full-size image is used when requesting the /api/part/<x>/ endpoint
|
# Note: The full-size image is used when requesting the /api/part/<x>/ endpoint
|
||||||
fn, ext = os.path.splitext(img)
|
|
||||||
|
|
||||||
thumb = "{fn}.thumbnail{ext}".format(fn=fn, ext=ext)
|
if img:
|
||||||
|
fn, ext = os.path.splitext(img)
|
||||||
|
|
||||||
item['thumbnail'] = os.path.join(settings.MEDIA_URL, thumb)
|
thumb = "{fn}.thumbnail{ext}".format(fn=fn, ext=ext)
|
||||||
|
|
||||||
|
thumb = os.path.join(settings.MEDIA_URL, thumb)
|
||||||
|
else:
|
||||||
|
thumb = ''
|
||||||
|
|
||||||
|
item['thumbnail'] = thumb
|
||||||
|
|
||||||
del item['image']
|
del item['image']
|
||||||
|
|
||||||
|
@ -340,12 +340,17 @@ class StockList(generics.ListCreateAPIView):
|
|||||||
|
|
||||||
img = item['part__image']
|
img = item['part__image']
|
||||||
|
|
||||||
# Use the thumbnail image instead
|
if img:
|
||||||
fn, ext = os.path.splitext(img)
|
# Use the thumbnail image instead
|
||||||
|
fn, ext = os.path.splitext(img)
|
||||||
|
|
||||||
thumb = "{fn}.thumbnail{ext}".format(fn=fn, ext=ext)
|
thumb = "{fn}.thumbnail{ext}".format(fn=fn, ext=ext)
|
||||||
|
|
||||||
item['part__thumbnail'] = os.path.join(settings.MEDIA_URL, thumb)
|
thumb = os.path.join(settings.MEDIA_URL, thumb)
|
||||||
|
else:
|
||||||
|
thumb = ''
|
||||||
|
|
||||||
|
item['part__thumbnail'] = thumb
|
||||||
|
|
||||||
del item['part__image']
|
del item['part__image']
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user