mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
fixes for unit testing
This commit is contained in:
parent
0840cebd57
commit
3eb585df27
@ -5,9 +5,9 @@ Provides information on the current InvenTree version
|
||||
import subprocess
|
||||
from common.models import InvenTreeSetting
|
||||
|
||||
|
||||
INVENTREE_SW_VERSION = "0.0.10"
|
||||
|
||||
|
||||
def inventreeInstanceName():
|
||||
""" Returns the InstanceName settings for the current database """
|
||||
return InvenTreeSetting.get_setting("InstanceName", "")
|
||||
|
@ -61,16 +61,20 @@ class CommonConfig(AppConfig):
|
||||
# See note above
|
||||
from .models import InvenTreeSetting
|
||||
|
||||
if not InvenTreeSetting.objects.filter(key='InstanceName').exists():
|
||||
try:
|
||||
if not InvenTreeSetting.objects.filter(key='InstanceName').exists():
|
||||
|
||||
val = uuid.uuid4().hex
|
||||
val = uuid.uuid4().hex
|
||||
|
||||
print("No 'InstanceName' found - generating random name '{n}'".format(n=val))
|
||||
print("No 'InstanceName' found - generating random name '{n}'".format(n=val))
|
||||
|
||||
name = InvenTreeSetting(
|
||||
key="InstanceName",
|
||||
value=val,
|
||||
description="Instance name for this InvenTree database installation."
|
||||
)
|
||||
name = InvenTreeSetting(
|
||||
key="InstanceName",
|
||||
value=val,
|
||||
description="Instance name for this InvenTree database installation."
|
||||
)
|
||||
|
||||
name.save()
|
||||
name.save()
|
||||
except (OperationalError, ProgrammingError):
|
||||
# Migrations have not yet been applied - table does not exist
|
||||
pass
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Generated by Django 2.2.10 on 2020-04-04 12:38
|
||||
|
||||
from django.db import migrations
|
||||
from django.db.utils import OperationalError
|
||||
from django.db.utils import OperationalError, ProgrammingError
|
||||
|
||||
from part.models import Part
|
||||
from stdimage.utils import render_variations
|
||||
@ -17,8 +17,9 @@ def create_thumbnails(apps, schema_editor):
|
||||
# Render thumbnail for each existing Part
|
||||
if part.image:
|
||||
part.image.render_variations()
|
||||
except OperationalError:
|
||||
print("Error - could not generate Part thumbnails")
|
||||
except (OperationalError, ProgrammingError):
|
||||
# Migrations have not yet been applied - table does not exist
|
||||
print("Could not generate Part thumbnails")
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user