2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-12 18:15:40 +00:00

Fix try statement

This commit is contained in:
Oliver Walters
2020-11-14 07:39:51 +11:00
parent b738f8b143
commit 2e842503e6

View File

@ -291,8 +291,10 @@ class InvenTreeSetting(models.Model):
setting = InvenTreeSetting(key=key, value=InvenTreeSetting.get_setting_default(key)) setting = InvenTreeSetting(key=key, value=InvenTreeSetting.get_setting_default(key))
with transaction.atomic(): try:
setting.save() # Wrap this statement in "atomic", so it can be rolled back if it fails
with transaction.atomic():
setting.save()
except (IntegrityError, OperationalError): except (IntegrityError, OperationalError):
# It might be the case that the database isn't created yet # It might be the case that the database isn't created yet
pass pass