return 409 on conflict
This commit is contained in:
parent
98a216eb1a
commit
c695e76a57
2 changed files with 4 additions and 4 deletions
|
@ -47,7 +47,7 @@ def addEvent(request):
|
||||||
response = json_response(status=200, text='created')
|
response = json_response(status=200, text='created')
|
||||||
response['data'] = event.json()
|
response['data'] = event.json()
|
||||||
else:
|
else:
|
||||||
response = json_response(status=403, text='name exists')
|
response = json_response(status=409, text='name exists')
|
||||||
response['data']['names'] = existing_names
|
response['data']['names'] = existing_names
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(addEvent, cache=False)
|
actions.register(addEvent, cache=False)
|
||||||
|
@ -92,7 +92,7 @@ def editEvent(request):
|
||||||
response = json_response(status=200, text='updated')
|
response = json_response(status=200, text='updated')
|
||||||
response['data'] = event.json()
|
response['data'] = event.json()
|
||||||
else:
|
else:
|
||||||
response = json_response(status=403, text='Event name conflict')
|
response = json_response(status=409, text='Event name conflict')
|
||||||
response['data']['names'] = conflict_names
|
response['data']['names'] = conflict_names
|
||||||
else:
|
else:
|
||||||
response = json_response(status=403, text='permission denied')
|
response = json_response(status=403, text='permission denied')
|
||||||
|
|
|
@ -62,7 +62,7 @@ def addPlace(request):
|
||||||
tasks.update_matches.delay(place.id)
|
tasks.update_matches.delay(place.id)
|
||||||
response = json_response(place.json())
|
response = json_response(place.json())
|
||||||
else:
|
else:
|
||||||
response = json_response(status=403,
|
response = json_response(status=409,
|
||||||
text='%s exists'%(existing_names and 'Name' or 'Geoname'))
|
text='%s exists'%(existing_names and 'Name' or 'Geoname'))
|
||||||
response['data']['names'] = existing_names
|
response['data']['names'] = existing_names
|
||||||
if existing_geoname:
|
if existing_geoname:
|
||||||
|
@ -110,7 +110,7 @@ def editPlace(request):
|
||||||
tasks.update_matches.delay(place.id)
|
tasks.update_matches.delay(place.id)
|
||||||
response = json_response(place.json())
|
response = json_response(place.json())
|
||||||
else:
|
else:
|
||||||
response = json_response(status=403,
|
response = json_response(status=409,
|
||||||
text='%s exists'%(conflict_names and 'Name' or 'Geoname'))
|
text='%s exists'%(conflict_names and 'Name' or 'Geoname'))
|
||||||
response['data']['names'] = conflict_names
|
response['data']['names'] = conflict_names
|
||||||
if conflict_geoname:
|
if conflict_geoname:
|
||||||
|
|
Loading…
Reference in a new issue