diff --git a/pandora/entity/models.py b/pandora/entity/models.py index e44ef67af..e126e8f28 100644 --- a/pandora/entity/models.py +++ b/pandora/entity/models.py @@ -181,13 +181,16 @@ class Entity(models.Model): Find.objects.filter(entity=self, key=key).delete() with transaction.commit_on_success(): + ids = ['name'] entity = get_by_id(settings.CONFIG['entities'], self.type) for key in entity['keys']: value = self.data.get(key['id']) if isinstance(value, list): value = u'\n'.join(value) save(key['id'], value) - + ids.append(key['id']) + save('name', u'\n'.join([self.name] + list(self.alternativeNames))) + self.find.exclude(key__in=ids).delete() def update_matches(self): import annotation.models