store name, remove unused keys
This commit is contained in:
parent
6407d711ce
commit
2dc081b8aa
1 changed files with 4 additions and 1 deletions
|
@ -181,13 +181,16 @@ class Entity(models.Model):
|
||||||
Find.objects.filter(entity=self, key=key).delete()
|
Find.objects.filter(entity=self, key=key).delete()
|
||||||
|
|
||||||
with transaction.commit_on_success():
|
with transaction.commit_on_success():
|
||||||
|
ids = ['name']
|
||||||
entity = get_by_id(settings.CONFIG['entities'], self.type)
|
entity = get_by_id(settings.CONFIG['entities'], self.type)
|
||||||
for key in entity['keys']:
|
for key in entity['keys']:
|
||||||
value = self.data.get(key['id'])
|
value = self.data.get(key['id'])
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
value = u'\n'.join(value)
|
value = u'\n'.join(value)
|
||||||
save(key['id'], 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):
|
def update_matches(self):
|
||||||
import annotation.models
|
import annotation.models
|
||||||
|
|
Loading…
Reference in a new issue