From 1fb075a3500df5686c69a48904f54687d851cb71 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 16 Apr 2015 10:53:05 +0100 Subject: [PATCH] rename layer --- pandora/annotation/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandora/annotation/models.py b/pandora/annotation/models.py index d34fb442c..f94788ecc 100644 --- a/pandora/annotation/models.py +++ b/pandora/annotation/models.py @@ -293,3 +293,9 @@ class Annotation(models.Model): def cleanup_related(sender, **kwargs): kwargs['instance'].cleanup_undefined_relations() pre_delete.connect(cleanup_related, sender=Annotation) + +def rename_layer(old, new): + import item.models + Annotation.objects.filter(layer=old).update(layer=new) + item.models.ItemFind.objects.filter(key=old).update(key=new) + item.models.Facet.objects.filter(key=old).update(key=new)