diff --git a/ippisite/ippidb/models.py b/ippisite/ippidb/models.py index b8e5042985f66dcbe420ece1da4545fad39fb003..8f233f8691f1163e1fc736b85ee81529312c7d42 100644 --- a/ippisite/ippidb/models.py +++ b/ippisite/ippidb/models.py @@ -895,6 +895,11 @@ class Compound(AutoFillableModel): return self.drugbankcompoundtanimoto_set.order_by("-tanimoto") def is_validated(self): + # if compound is not linked to any CompoundAction this is + # because it was dereferenced because of duplication by + # `replace_compound_references` + if self.compoundaction_set.count()==0: + return False for ca in self.compoundaction_set.all(): if ca.ppi.contribution_set.filter(validated=False).exists(): return False