2
0
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:
Oliver Walters
2020-04-07 11:23:30 +10:00
parent 1a233e7949
commit e0655f61d8
3 changed files with 33 additions and 3 deletions

View File

@ -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)