forked from 0x2620/pandora
dont use lambda in default
This commit is contained in:
parent
a035d37229
commit
543d01696e
3 changed files with 12 additions and 3 deletions
|
@ -34,6 +34,9 @@ def get_collectionview():
|
||||||
def get_collectionsort():
|
def get_collectionsort():
|
||||||
return tuple(settings.CONFIG['user']['ui']['collectionSort'])
|
return tuple(settings.CONFIG['user']['ui']['collectionSort'])
|
||||||
|
|
||||||
|
def default_query():
|
||||||
|
return {"static": True}
|
||||||
|
|
||||||
class Collection(models.Model):
|
class Collection(models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -46,7 +49,7 @@ class Collection(models.Model):
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
status = models.CharField(max_length=20, default='private')
|
status = models.CharField(max_length=20, default='private')
|
||||||
_status = ['private', 'public', 'featured']
|
_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')
|
type = models.CharField(max_length=255, default='static')
|
||||||
description = models.TextField(default='')
|
description = models.TextField(default='')
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,9 @@ User = get_user_model()
|
||||||
def get_path(f, x): return f.path(x)
|
def get_path(f, x): return f.path(x)
|
||||||
def get_icon_path(f, x): return get_path(f, 'icon.jpg')
|
def get_icon_path(f, x): return get_path(f, 'icon.jpg')
|
||||||
|
|
||||||
|
def default_query():
|
||||||
|
return {"static": True}
|
||||||
|
|
||||||
class Edit(models.Model):
|
class Edit(models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -53,7 +56,7 @@ class Edit(models.Model):
|
||||||
description = models.TextField(default='')
|
description = models.TextField(default='')
|
||||||
rightslevel = models.IntegerField(db_index=True, default=0)
|
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')
|
type = models.CharField(max_length=255, default='static')
|
||||||
|
|
||||||
icon = models.ImageField(default=None, blank=True, null=True, upload_to=get_icon_path)
|
icon = models.ImageField(default=None, blank=True, null=True, upload_to=get_icon_path)
|
||||||
|
|
|
@ -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_listview(): return settings.CONFIG['user']['ui']['listView']
|
||||||
def get_listsort(): return tuple(settings.CONFIG['user']['ui']['listSort'])
|
def get_listsort(): return tuple(settings.CONFIG['user']['ui']['listSort'])
|
||||||
|
|
||||||
|
def default_query():
|
||||||
|
return {"static": True}
|
||||||
|
|
||||||
class List(models.Model):
|
class List(models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -38,7 +41,7 @@ class List(models.Model):
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
status = models.CharField(max_length=20, default='private')
|
status = models.CharField(max_length=20, default='private')
|
||||||
_status = ['private', 'public', 'featured']
|
_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')
|
type = models.CharField(max_length=255, default='static')
|
||||||
description = models.TextField(default='')
|
description = models.TextField(default='')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue