diff options
-rw-r--r-- | CHANGES.md | 9 | ||||
-rw-r--r-- | ishtar_common/utils.py | 14 | ||||
-rw-r--r-- | ishtar_common/version.py | 4 |
3 files changed, 20 insertions, 7 deletions
diff --git a/CHANGES.md b/CHANGES.md index 8dfeb312c..e9dda6ecc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,11 +1,18 @@ --- title: Ishtar changelog -date: 2022-06-02 +date: 2022-06-08 --- Ishtar changelog ================ +v3.1.74 - 2022-06-08 +-------------------- + +### Features ### + +- ID: allow use "data" field to generate ID + v3.1.73 - 2022-06-07 -------------------- diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index bad6399df..5bd5f4ec5 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -1943,10 +1943,16 @@ def _update_gen_id_dct(item, dct, initial_key, fkey=None, filters=None): return obj = item for k in fkey.split("__"): - try: - obj = getattr(obj, k) - except (ObjectDoesNotExist, AttributeError): - obj = None + if isinstance(obj, dict): + if k not in obj: + obj = None + break + obj = obj[k] + else: + try: + obj = getattr(obj, k) + except (ObjectDoesNotExist, AttributeError): + obj = None if hasattr(obj, "all") and hasattr(obj, "count"): # query manager if not obj.count(): break diff --git a/ishtar_common/version.py b/ishtar_common/version.py index 276033fb0..89fcb4e7d 100644 --- a/ishtar_common/version.py +++ b/ishtar_common/version.py @@ -1,5 +1,5 @@ -# 3.1.73 -VERSION = (3, 1, 73) +# 3.1.74 +VERSION = (3, 1, 74) def get_version(): |