mirror of
https://github.com/inventree/InvenTree.git
synced 2025-09-14 06:31:27 +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:
@@ -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):
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user