diff options
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/models.py | 6 | 
1 files changed, 5 insertions, 1 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 7d7b6c872..faf3ad3dd 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2542,7 +2542,11 @@ def get_external_id(key, item):                  obj = getattr(obj, k)              except ObjectDoesNotExist:                  obj = None -            if callable(obj): +            if hasattr(obj, 'all') and hasattr(obj, 'count'):  # query manager +                if not obj.count(): +                    break +                obj = obj.all()[0] +            elif callable(obj):                  obj = obj()              if obj is None:                  break  | 
