diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-06-09 17:23:11 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-08 09:59:31 +0200 |
commit | 97efd6f8bb4ea3bb1655d27f0eff160b34ac530f (patch) | |
tree | 01fdc36f18e8828bc413f4a975b1d06a555d82a6 | |
parent | 3633afff5b517170cae0889567c666f5a0b1df6e (diff) | |
download | Ishtar-97efd6f8bb4ea3bb1655d27f0eff160b34ac530f.tar.bz2 Ishtar-97efd6f8bb4ea3bb1655d27f0eff160b34ac530f.zip |
JSON fields: fix multi-value choices fields
-rw-r--r-- | CHANGES-DEV.md | 3 | ||||
-rw-r--r-- | ishtar_common/models_common.py | 2 | ||||
-rw-r--r-- | ishtar_common/widgets.py | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/CHANGES-DEV.md b/CHANGES-DEV.md index e7d2a1cd5..7636d4112 100644 --- a/CHANGES-DEV.md +++ b/CHANGES-DEV.md @@ -1,6 +1,6 @@ --- title: Ishtar changelog -date: 2022-05-17 +date: 2022-06-09 --- Ishtar develop changelog v3.2 @@ -45,4 +45,5 @@ Ishtar develop changelog v3.2 - Many to one treatment: fix attribute conservation - Sheet: silently fails when missing graph relations image is missing - Import delete: do not crash when no SLUG is available for an attached item +- JSON fields: fix multi-value choices fields diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index ecbabcf7a..aae79c4fe 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -1097,7 +1097,7 @@ class JsonData(models.Model, CachedGen): c = [("", "")] c += [(v, v) for v in sorted(list(choices))] cache.set(cache_key, c, settings.CACHE_SMALLTIMEOUT) - return choices + return c class FixAssociated: diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index 1f5a169ba..4852f4ceb 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -140,7 +140,7 @@ class Select2DynamicBase(Select2Media): value = value[0] values = value for va in values: - if va not in [key for key, va in choices]: + if va not in [key for key, v in choices]: choices.insert(1, (va, va)) self.choices = choices klass = attrs and attrs.get("class") or "" |