mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Part and company images return the 'no image found' image if they do not have an image
This commit is contained in:
parent
4c4df194fa
commit
94ad378b9d
@ -10,6 +10,7 @@ import os
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
from django.conf import settings
|
||||
from django.contrib.staticfiles.templatetags.staticfiles import static
|
||||
|
||||
|
||||
def rename_company_image(instance, filename):
|
||||
@ -85,7 +86,7 @@ class Company(models.Model):
|
||||
if self.image:
|
||||
return os.path.join(settings.MEDIA_URL, str(self.image.url))
|
||||
else:
|
||||
return ''
|
||||
return static('/img/blank_image.png')
|
||||
|
||||
@property
|
||||
def part_count(self):
|
||||
|
@ -19,6 +19,7 @@ from django.conf import settings
|
||||
from django.db import models
|
||||
from django.core.validators import MinValueValidator
|
||||
|
||||
from django.contrib.staticfiles.templatetags.staticfiles import static
|
||||
from django.contrib.auth.models import User
|
||||
from django.db.models.signals import pre_delete
|
||||
from django.dispatch import receiver
|
||||
@ -130,7 +131,7 @@ class Part(models.Model):
|
||||
if self.image:
|
||||
return os.path.join(settings.MEDIA_URL, str(self.image.url))
|
||||
else:
|
||||
return ''
|
||||
return static('/img/blank_image.png')
|
||||
|
||||
# Short name of the part
|
||||
name = models.CharField(max_length=100, unique=True, blank=False, help_text='Part name (must be unique)')
|
||||
|
Loading…
Reference in New Issue
Block a user