Create thumbnails for Company model

This commit is contained in:
Oliver Walters 2020-04-07 11:17:00 +10:00
parent 16d3a87e78
commit 1a233e7949
2 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,20 @@
# Generated by Django 2.2.10 on 2020-04-07 01:16
import company.models
from django.db import migrations
import stdimage.models
class Migration(migrations.Migration):
dependencies = [
('company', '0013_auto_20200406_0131'),
]
operations = [
migrations.AlterField(
model_name='company',
name='image',
field=stdimage.models.StdImageField(blank=True, null=True, upload_to=company.models.rename_company_image),
),
]

View File

@ -21,6 +21,8 @@ from django.conf import settings
from markdownx.models import MarkdownxField
from stdimage.models import StdImageField
from InvenTree.fields import InvenTreeURLField, RoundingDecimalField
from InvenTree.status_codes import OrderStatus
from common.models import Currency
@ -90,7 +92,13 @@ class Company(models.Model):
link = InvenTreeURLField(blank=True, help_text=_('Link to external company information'))
image = models.ImageField(upload_to=rename_company_image, max_length=255, null=True, blank=True)
image = StdImageField(
upload_to=rename_company_image,
null=True,
blank=True,
variations={'thumnbnail': (128, 128)},
delete_orphans=True,
)
notes = MarkdownxField(blank=True)