From 8136a2c2f57fbbd7e261dd758665d0cc886cd4a1 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 25 Aug 2016 17:13:38 +0200 Subject: [PATCH] create new item if unregistered file gets uploaded --- pandora/archive/views.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pandora/archive/views.py b/pandora/archive/views.py index 034640002..93cfdb9a7 100644 --- a/pandora/archive/views.py +++ b/pandora/archive/views.py @@ -321,14 +321,19 @@ def direct_upload(request): t = file.extract_stream() response['resultUrl'] = t.task_id except: + print('ERROR: rabbitmq is down') pass return render_to_json_response(response) # init upload else: file, created = models.File.objects.get_or_create(oshash=oshash) if file.editable(request.user): - # remove previous uploads - if not created: + if created: + if not file.item: + file.item = get_item({ + 'title': oshash + }, user=request.user) + else: # remove previous uploads file.streams.all().delete() file.delete_frames() if file.item.rendered and file.selected: