diff --git a/pandora/edit/models.py b/pandora/edit/models.py index ad33d438b..05d970910 100644 --- a/pandora/edit/models.py +++ b/pandora/edit/models.py @@ -75,10 +75,12 @@ class Edit(models.Model): if 'annotation' in data and data['annotation']: c.annotation = Annotation.objects.get(public_id=data['annotation']) c.item = c.annotation.item - else: + elif 'item' in data and 'in' in data and 'out' in data: c.item = Item.objects.get(public_id=data['item']) c.start = data['in'] c.end = data['out'] + else: + return False if index != None: c.index = index # dont add clip if in/out are invalid diff --git a/pandora/edit/views.py b/pandora/edit/views.py index 6e49f7e25..1a4177047 100644 --- a/pandora/edit/views.py +++ b/pandora/edit/views.py @@ -55,7 +55,7 @@ def addClips(request, data): if edit.editable(request.user): clips = edit.add_clips(data['clips'], data.get('index'), request.user) if not clips: - response = json_response(status=500, text='invalid in/out') + response = json_response(status=500, text='invalid or missing item/in/out') return render_to_json_response(response) add_changelog(request, data, edit.get_id()) response['data']['clips'] = clips @@ -268,7 +268,7 @@ def addEdit(request, data): if 'clips' in data and edit.type == 'static': clips = edit.add_clips(data['clips'], 0, request.user) if not clips: - response = json_response(status=500, text='invalid in/out') + response = json_response(status=500, text='invalid or missing item/in/out') return render_to_json_response(response) if edit.status == 'featured':