mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-15 03:25:42 +00:00
Display supplier logo in part suppliers list
- Also add a background colour for popup image in case of transparent image file
This commit is contained in:
@ -9,6 +9,7 @@ import os
|
||||
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
def rename_company_image(instance, filename):
|
||||
@ -78,6 +79,14 @@ class Company(models.Model):
|
||||
""" Get the web URL for the detail view for this Company """
|
||||
return reverse('company-detail', kwargs={'pk': self.id})
|
||||
|
||||
def get_image_url(self):
|
||||
""" Return the URL of the image for this company """
|
||||
|
||||
if self.image:
|
||||
return os.path.join(settings.MEDIA_URL, str(self.image.url))
|
||||
else:
|
||||
return ''
|
||||
|
||||
@property
|
||||
def part_count(self):
|
||||
""" The number of parts supplied by this company """
|
||||
|
Reference in New Issue
Block a user