Skip to content
Snippets Groups Projects
Commit e0640eb4 authored by Herman Andersen Dyrkorn's avatar Herman Andersen Dyrkorn
Browse files

new if statement

parent e3aa870f
No related branches found
No related tags found
1 merge request!37Resolve "rematch function and endpoint"
......@@ -87,8 +87,8 @@ class SalamanderClass(Resource):
if "length" in data:
growth_row.length = sanitize_number_str(str(data['length']))
db.session.commit()
if "location" in data and "new_location" in data and "new_sex" in data \
and "new_species" in data and (data['location'] != data['new_location'] and data['sex'] != data['new_sex']):
if "location" in data and "new_location" in data and "new_sex" in data and "new_species" in data:
if data['location'] != data['new_location'] and data['sex'] != data['new_sex'] and data['species'] != data['new_species']:
salamander_path = os.path.join("images", data['location'], salamander.species, salamander.sex,
str(salamander.id))
new_path_to_images = os.path.join("images", data['new_location'], data['new_species'],
......@@ -150,6 +150,8 @@ class SalamanderClass(Resource):
return jsonify(
{"message": "Image id, " + data['image_id'] + " does not exist in salamander_id, " + data[
'id'], 'status': 400})
else:
return jsonify({"message": "salamander cannot be moved to the same location", 'status': 400})
else:
return jsonify({"message": "done editing(not, moved)", 'status': 200})
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment