Refactor add-service form such that the dao is not exposed in the forms.

This commit is contained in:
Rebecca Law
2016-01-04 15:31:50 +00:00
parent 75bafd7a7d
commit ac05f6931e
9 changed files with 57 additions and 35 deletions

View File

@@ -1,5 +1,7 @@
from datetime import datetime
from sqlalchemy.orm import load_only
from app import db
from app.models import Service
@@ -39,3 +41,7 @@ def add_service(service):
def find_service_by_service_name(service_name):
return Service.query.filter_by(name=service_name).first()
def find_all_service_names():
return [x.name for x in Service.query.options(load_only("name")).all()]