From 3f84a781ec927186ee46a81846755a2f9a9a47e1 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Fri, 21 Aug 2015 15:44:23 +0100 Subject: [PATCH] Update items when entities are renamed (fixes #2825) A bit sad to lean on: if a.modified >= a.item.annotations.order_by('-modified')[0].modified: in update_item to avoid repeatedly updating the same item... --- pandora/entity/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandora/entity/models.py b/pandora/entity/models.py index 8a5bfa1..046827d 100644 --- a/pandora/entity/models.py +++ b/pandora/entity/models.py @@ -230,11 +230,14 @@ class Entity(models.Model): def update_annotations(self): import annotation.models + import annotation.tasks + entity_layers = [l['id'] for l in settings.CONFIG['layers'] if l['type'] == 'entity'] if entity_layers: with transaction.commit_on_success(): for a in annotation.models.Annotation.objects.filter(layer__in=entity_layers, value=self.get_id()): a.save() + annotation.tasks.update_item.delay(a.id) class DocumentProperties(models.Model): -- 2.4.3