2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-15 03:25:42 +00:00

Use the company thumbnail in the Company API

This commit is contained in:
Oliver Walters
2020-04-07 11:27:56 +10:00
parent e0655f61d8
commit ae9ef04013
2 changed files with 10 additions and 2 deletions

View File

@ -122,6 +122,14 @@ class Company(models.Model):
else:
return os.path.join(settings.STATIC_URL, 'img/blank_image.png')
def get_thumbnail_url(self):
""" Return the URL for the thumbnail image for this Company """
if self.image:
return os.path.join(settings.MEDIA_URL, str(self.image.thumbnail.url))
else:
return os.path.join(settings.STATIC_URL, 'img/blank_image.thumbnail.png')
@property
def part_count(self):
""" The number of parts supplied by this company """