From f9a70c728542ee69a4d7b5664897d4f4eefc3b71 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 11 Feb 2012 18:13:02 +0530 Subject: [PATCH] fix numberoffiles --- pandora/archive/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora/archive/views.py b/pandora/archive/views.py index 45ec64ea1..fa84ccf92 100644 --- a/pandora/archive/views.py +++ b/pandora/archive/views.py @@ -369,7 +369,11 @@ def removeFiles(request): data = json.loads(request.POST['data']) response = json_response() if request.user.get_profile().get_level() == 'admin': - models.File.objects.filter(oshash__in=data['ids'], instances__id=None).delete() + qs = models.File.objects.filter(oshash__in=data['ids'], instances__id=None) + for f in qs: + f.item.sort.numberoffiles -= 1 + f.item.sort.save() + qs.delete() else: response = json_response(status=403, text='permissino denied') return render_to_json_response(response)