2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 11:40:58 +00:00

Bugfix for auto-backup task (#4406)

* Bugfix for auto-backup task

- Dont' mix datetime with timezone

* Use different variable names

- If old names are stuck in the database, error could still occur

* Exclude internal settings from API

* Make INVENTREE_LATEST_VERSION setting an internal one
This commit is contained in:
Oliver
2023-02-25 13:53:57 +11:00
committed by GitHub
parent f523fb44f6
commit fd84e590ec
5 changed files with 18 additions and 14 deletions

View File

@ -187,7 +187,7 @@ class SettingsList(ListAPI):
class GlobalSettingsList(SettingsList):
"""API endpoint for accessing a list of global settings objects."""
queryset = common.models.InvenTreeSetting.objects.all()
queryset = common.models.InvenTreeSetting.objects.exclude(key__startswith="_")
serializer_class = common.serializers.GlobalSettingsSerializer
@ -216,7 +216,7 @@ class GlobalSettingsDetail(RetrieveUpdateAPI):
"""
lookup_field = 'key'
queryset = common.models.InvenTreeSetting.objects.all()
queryset = common.models.InvenTreeSetting.objects.exclude(key__startswith="_")
serializer_class = common.serializers.GlobalSettingsSerializer
def get_object(self):

View File

@ -180,6 +180,10 @@ class BaseInvenTreeSetting(models.Model):
"""
results = cls.objects.all()
if exclude_hidden:
# Keys which start with an undersore are used for internal functionality
results = results.exclude(key__startswith='_')
# Optionally filter by user
if user is not None:
results = results.filter(user=user)