2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Devcontainer postgresql (#6590)

* Working on devcontainer with postgresql

* Fix for docker-compose.yml

* Update postCreateCommand

* Tweak docker compose file

* Fix Dockerfile

- Do not use uv (breaks process)

* Update postCreateCommand.sh

- Skip database backup

* Tweak file

* Further improvements

- Remove 'devcontainer' Dockerfile target
- Fix postCreateCommand

* Further cleanup

* Reduce SQL errors

- Use filter().exists() rather than get()

* Set default SITE_URL

* Docs updates

* Fix hard-coded django version

* Update faq.md

* Typo fix: PluginObject -> PluginConfig

* Docs: strict mode

* docs: fix link

* docs: fix typo

* Fix error message

* Revert change to config_template default
This commit is contained in:
Oliver
2024-02-28 15:04:14 +11:00
committed by GitHub
parent 8f8b46e50d
commit 2e81a304d1
16 changed files with 388 additions and 360 deletions

View File

@ -675,12 +675,14 @@ class BaseInvenTreeSetting(models.Model):
}
try:
setting = cls.objects.get(**filters)
except cls.DoesNotExist:
if create:
setting = cls(key=key, **kwargs)
else:
return
setting = cls.objects.filter(**filters).first()
if not setting:
if create:
setting = cls(key=key, **kwargs)
else:
return
except (OperationalError, ProgrammingError):
if not key.startswith('_'):
logger.warning("Database is locked, cannot set setting '%s'", key)

View File

@ -289,13 +289,13 @@ def check_plugin(plugin_slug: str, plugin_pk: int) -> InvenTreePlugin:
# Check that the 'plugin' specified is valid
try:
plugin_cgf = PluginConfig.objects.get(**filter)
plugin_cgf = PluginConfig.objects.filter(**filter).first()
except PluginConfig.DoesNotExist:
raise NotFound(detail=f"Plugin '{ref}' not installed")
if plugin_cgf is None:
# This only occurs if the plugin mechanism broke
raise NotFound(detail=f"Plugin '{ref}' not found") # pragma: no cover
raise NotFound(detail=f"Plugin '{ref}' not installed") # pragma: no cover
# Check that the plugin is activated
if not plugin_cgf.active:

View File

@ -115,7 +115,11 @@ class PluginsRegistry:
return None
try:
cfg, _created = PluginConfig.objects.get_or_create(key=slug)
cfg = PluginConfig.objects.filter(key=slug).first()
if not cfg:
cfg = PluginConfig.objects.create(key=slug)
except PluginConfig.DoesNotExist:
return None
except (IntegrityError, OperationalError, ProgrammingError): # pragma: no cover