Bug fix for static lookup of blank image

This commit is contained in:
Oliver Walters 2019-12-09 20:40:04 +11:00
parent 0ef033f800
commit 5e9b012031
2 changed files with 2 additions and 4 deletions

View File

@ -17,7 +17,6 @@ from django.db.models import Sum
from django.apps import apps from django.apps import apps
from django.urls import reverse from django.urls import reverse
from django.conf import settings from django.conf import settings
from django.conf.urls.static import static
from InvenTree.fields import InvenTreeURLField from InvenTree.fields import InvenTreeURLField
from InvenTree.status_codes import OrderStatus from InvenTree.status_codes import OrderStatus
@ -110,7 +109,7 @@ class Company(models.Model):
if self.image: if self.image:
return os.path.join(settings.MEDIA_URL, str(self.image.url)) return os.path.join(settings.MEDIA_URL, str(self.image.url))
else: else:
return static('/img/blank_image.png') return os.path.join(settings.STATIC_URL, 'img/blank_image.png')
@property @property
def part_count(self): def part_count(self):

View File

@ -18,7 +18,6 @@ from django.db.models import Sum
from django.db.models import prefetch_related_objects from django.db.models import prefetch_related_objects
from django.core.validators import MinValueValidator from django.core.validators import MinValueValidator
from django.conf.urls.static import static
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db.models.signals import pre_delete from django.db.models.signals import pre_delete
from django.dispatch import receiver from django.dispatch import receiver
@ -281,7 +280,7 @@ class Part(models.Model):
if self.image: if self.image:
return os.path.join(settings.MEDIA_URL, str(self.image.url)) return os.path.join(settings.MEDIA_URL, str(self.image.url))
else: else:
return static('/img/blank_image.png') return os.path.join(settings.STATIC_URL, 'img/blank_image.png')
def validate_unique(self, exclude=None): def validate_unique(self, exclude=None):
""" Validate that a part is 'unique'. """ Validate that a part is 'unique'.