Updates from review comments:

Update api_key relationship.
Check that id in dict exists before deleting it
This commit is contained in:
Rebecca Law
2016-01-19 13:11:22 +00:00
parent 43d54b6ad3
commit 15b2d414cc
5 changed files with 8 additions and 7 deletions

View File

@@ -7,7 +7,8 @@ from app.models import ApiKey
def save_model_api_key(api_key, update_dict={}):
if update_dict:
del update_dict['id']
if update_dict['id']:
del update_dict['id']
db.session.query(ApiKey).filter_by(id=api_key.id).update(update_dict)
else:
api_key.secret = _generate_secret()