Merge remote-tracking branch 'inventree/master' into sales-order

# Conflicts:
#	InvenTree/InvenTree/version.py
This commit is contained in:
Oliver Walters 2020-04-27 22:04:05 +10:00
commit 394a9208a1
2 changed files with 11 additions and 23 deletions

View File

@ -1,32 +1,20 @@
# Generated by Django 2.2.10 on 2020-04-04 12:38 # Generated by Django 2.2.10 on 2020-04-04 12:38
from django.db import migrations from django.db import migrations
from django.db.utils import OperationalError, ProgrammingError
from part.models import Part
from stdimage.utils import render_variations
def create_thumbnails(apps, schema_editor): def create_thumbnails(apps, schema_editor):
""" """
Create thumbnails for all existing Part images. Create thumbnails for all existing Part images.
"""
try: Note: This functionality is now performed in apps.py,
for part in Part.objects.all(): as running the thumbnail script here caused too many database level errors.
# Render thumbnail for each existing Part
if part.image: This migration is left here to maintain the database migration history
try:
part.image.render_variations() """
except FileNotFoundError: pass
print("Missing image:", part.image())
# The image is missing, so clear the field
part.image = None
part.save()
except (OperationalError, ProgrammingError):
# Migrations have not yet been applied - table does not exist
print("Could not generate Part thumbnails")
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -35,5 +23,5 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(create_thumbnails), migrations.RunPython(create_thumbnails, reverse_code=create_thumbnails),
] ]

View File

@ -31,12 +31,12 @@ superuser:
# Install pre-requisites for mysql setup # Install pre-requisites for mysql setup
mysql: mysql:
apt-get install mysql-server libmysqlclient-dev sudo apt-get install mysql-server libmysqlclient-dev
pip3 install mysqlclient pip3 install mysqlclient
# Install pre-requisites for postgresql setup # Install pre-requisites for postgresql setup
postgresql: postgresql:
apt-get install postgresql postgresql-contrib libpq-dev sudo apt-get install postgresql postgresql-contrib libpq-dev
pip3 install psycopg2 pip3 install psycopg2
# Update translation files # Update translation files