only cleanup clips related to item, gets to slow with many annotations

This commit is contained in:
j 2012-05-27 15:16:07 +00:00
parent 12226662f8
commit 19a56af125

View file

@ -69,7 +69,7 @@ def update_item(id):
from clip.models import Clip from clip.models import Clip
a = models.Annotation.objects.get(pk=id) a = models.Annotation.objects.get(pk=id)
#cleanup orphaned clips #cleanup orphaned clips
Clip.objects.filter(annotations__id=None).delete() Clip.objects.filter(item__id=a.item.id, annotations__id=None).delete()
#update facets if needed #update facets if needed
if filter(lambda f: f['id'] == a.layer, settings.CONFIG['filters']): if filter(lambda f: f['id'] == a.layer, settings.CONFIG['filters']):
a.item.update_layer_facet(a.layer) a.item.update_layer_facet(a.layer)