From 2dc081b8aaaf39eafd73fcda3af0991a8a59d4c6 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 17 Apr 2015 16:01:49 +0100 Subject: [PATCH] store name, remove unused keys --- pandora/entity/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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