mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 21:15:41 +00:00
Check if Company thumbnails are created on Company app start
This commit is contained in:
@ -20,13 +20,14 @@ class PartConfig(AppConfig):
|
||||
def generate_part_thumbnails(self):
|
||||
from .models import Part
|
||||
|
||||
print("Checking Part image thumbnails")
|
||||
print("InvenTree: Checking Part image thumbnails")
|
||||
|
||||
try:
|
||||
for part in Part.objects.all():
|
||||
if part.image:
|
||||
url = part.image.thumbnail.name
|
||||
loc = os.path.join(settings.MEDIA_ROOT, url)
|
||||
|
||||
if not os.path.exists(loc):
|
||||
print("InvenTree: Generating thumbnail for Part '{p}'".format(p=part.name))
|
||||
part.image.render_variations(replace=False)
|
||||
|
Reference in New Issue
Block a user