diff options
Diffstat (limited to 'ishtar_common/utils.py')
| -rw-r--r-- | ishtar_common/utils.py | 14 | 
1 files changed, 10 insertions, 4 deletions
| 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 | 
