summaryrefslogtreecommitdiff
path: root/ishtar_common/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r--ishtar_common/utils.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py
index c6c14422c..673821c14 100644
--- a/ishtar_common/utils.py
+++ b/ishtar_common/utils.py
@@ -544,6 +544,7 @@ def load_task(task_func, task_name, checks, sender, **kwargs):
def cached_label_changed(sender, **kwargs):
+ load_task(_external_id_changed, "external_id_changed", None, sender, **kwargs)
return load_task(_cached_label_changed, "cached_label_changed", None, sender,
**kwargs)
@@ -633,7 +634,8 @@ def external_id_changed(sender, **kwargs):
@task()
def _external_id_changed(sender, **kwargs):
sender, instance = deserialize_args_for_tasks(sender, kwargs, EXTRA_KWARGS_TRIGGER)
- if not instance:
+ if not instance or not hasattr(instance, "external_id") \
+ or not hasattr(instance, "auto_external_id"):
return
updated = False
instance.no_post_process()
@@ -643,12 +645,12 @@ def _external_id_changed(sender, **kwargs):
updated = True
instance.auto_external_id = True
instance.external_id = external_id
- updated |= instance.regenerate_all_ids(save=False)
+ if hasattr(instance, "regenerate_all_ids"):
+ updated |= instance.regenerate_all_ids(save=False) or False
if updated:
instance.save()
-
def shortify(lbl, number=20):
SHORTIFY_STR = ugettext(" (...)")
if not lbl: