Working code and tests.

This commit is contained in:
Nicholas Staples
2016-01-22 14:43:30 +00:00
parent 2c4f2c92b5
commit a9fe6ad469
8 changed files with 143 additions and 117 deletions

View File

@@ -23,6 +23,7 @@ def delete_model_template(template):
def get_model_templates(template_id=None, service_id=None):
temp = Template.query.first()
# TODO need better mapping from function params to sql query.
if template_id and service_id:
return Template.query.filter_by(
@@ -30,5 +31,5 @@ def get_model_templates(template_id=None, service_id=None):
elif template_id:
return Template.query.filter_by(id=template_id).one()
elif service_id:
return Template.query.filter_by(service=Service.get(service_id)).one()
return Template.query.filter_by(service=Service.query.get(service_id)).one()
return Template.query.all()