From 543d01696ee76629535f6c3faaecc12ec001017a Mon Sep 17 00:00:00 2001 From: j Date: Thu, 27 Jul 2023 23:30:19 +0200 Subject: [PATCH] dont use lambda in default --- pandora/documentcollection/models.py | 5 ++++- pandora/edit/models.py | 5 ++++- pandora/itemlist/models.py | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pandora/documentcollection/models.py b/pandora/documentcollection/models.py index 8504ae47..be600b54 100644 --- a/pandora/documentcollection/models.py +++ b/pandora/documentcollection/models.py @@ -34,6 +34,9 @@ def get_collectionview(): def get_collectionsort(): return tuple(settings.CONFIG['user']['ui']['collectionSort']) +def default_query(): + return {"static": True} + class Collection(models.Model): class Meta: @@ -46,7 +49,7 @@ class Collection(models.Model): name = models.CharField(max_length=255) status = models.CharField(max_length=20, default='private') _status = ['private', 'public', 'featured'] - query = JSONField(default=lambda: {"static": True}, editable=False) + query = JSONField(default=default_query, editable=False) type = models.CharField(max_length=255, default='static') description = models.TextField(default='') diff --git a/pandora/edit/models.py b/pandora/edit/models.py index 907dc579..5008ac45 100644 --- a/pandora/edit/models.py +++ b/pandora/edit/models.py @@ -35,6 +35,9 @@ User = get_user_model() def get_path(f, x): return f.path(x) def get_icon_path(f, x): return get_path(f, 'icon.jpg') +def default_query(): + return {"static": True} + class Edit(models.Model): class Meta: @@ -53,7 +56,7 @@ class Edit(models.Model): description = models.TextField(default='') rightslevel = models.IntegerField(db_index=True, default=0) - query = JSONField(default=lambda: {"static": True}, editable=False) + query = JSONField(default=default_query, editable=False) type = models.CharField(max_length=255, default='static') icon = models.ImageField(default=None, blank=True, null=True, upload_to=get_icon_path) diff --git a/pandora/itemlist/models.py b/pandora/itemlist/models.py index ad2cfb14..a7a6f8f4 100644 --- a/pandora/itemlist/models.py +++ b/pandora/itemlist/models.py @@ -26,6 +26,9 @@ def get_icon_path(f, x): return get_path(f, 'icon.jpg') def get_listview(): return settings.CONFIG['user']['ui']['listView'] def get_listsort(): return tuple(settings.CONFIG['user']['ui']['listSort']) +def default_query(): + return {"static": True} + class List(models.Model): class Meta: @@ -38,7 +41,7 @@ class List(models.Model): name = models.CharField(max_length=255) status = models.CharField(max_length=20, default='private') _status = ['private', 'public', 'featured'] - query = JSONField(default=lambda: {"static": True}, editable=False) + query = JSONField(default=default_query, editable=False) type = models.CharField(max_length=255, default='static') description = models.TextField(default='')