addClips: return error if item/in/out missing, not 500
This commit is contained in:
parent
819181726a
commit
3da3bd37fd
2 changed files with 5 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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':
|
||||
|
|
Loading…
Reference in a new issue