From 52b524430cd4b02123585484155169c188ae48c6 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 30 Jan 2012 16:02:19 +0530 Subject: [PATCH] handle new version of file with old one moved to versions --- pandora/archive/tasks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandora/archive/tasks.py b/pandora/archive/tasks.py index 8bacd84a..57dc2015 100644 --- a/pandora/archive/tasks.py +++ b/pandora/archive/tasks.py @@ -78,13 +78,15 @@ def update_files(user, volume, files): for f in files: if len(f['path'].split('/')) == folder_depth: all_files.append(f['oshash']) - update_or_create_instance(volume, f) #remove deleted files removed = models.Instance.objects.filter(volume=volume).exclude(file__oshash__in=all_files) ids = [i['itemId'] for i in Item.objects.filter( files__instances__in=removed.filter(file__selected=True)).distinct().values('itemId')] removed.delete() + for f in files: + if f['oshash'] in all_files: + update_or_create_instance(volume, f) for i in ids: i = Item.objects.get(itemId=i) i.update_selected()