products/models.py: get_all_image_urls() add option for full url
This commit is contained in:
@ -108,9 +108,12 @@ class ProductImage:
|
||||
# return path.replace(ProductImage.THUMB_DIR, ProductImage.THUMB_URL)
|
||||
|
||||
@staticmethod
|
||||
def get_all_image_urls(sap, image_format):
|
||||
def get_all_image_urls(sap, image_format, full_url=False):
|
||||
paths = ProductImage.get_all_image_paths(sap, image_format)
|
||||
return [p.replace(ProductImage.THUMB_DIR, ProductImage.THUMB_URL) for p in paths]
|
||||
url_prefix = ProductImage.THUMB_URL
|
||||
if full_url:
|
||||
url_prefix = f'https://{settings.PUBLIC_WEB_HOST}{url_prefix}'
|
||||
return [p.replace(ProductImage.THUMB_DIR, url_prefix) for p in paths]
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user