Skip to content

Commit fbccf81

Browse files
forgot to add
1 parent 944ee55 commit fbccf81

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

lib/app/TitleDelegate.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from recipe import Recipe
22

3-
class UploadDelegate:
43

5-
def __init__(self):
6-
4+
class UploadDelegate:
5+
def getRecipesByTitle(self, title):
6+
recipes = Recipe.query.titleIsLike(title)
7+
toJson = list(map(lambda r: r.toJson()), recipes)
8+
return toJson

lib/app/__init__.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
from flask import Flask
2-
from flask_mongoengine import MongoEngine
2+
from flask.ext.mongoalchemy import MongoAlchemy
33
app = Flask(__name__)
4-
db=MongoEngine()
5-
app.config["MONGODB_SETTINGS"] = {
6-
'db':'recipe-mongo',
7-
'host':'172.17.0.2',
8-
'port': 27017
4+
app.config["DEBUG"] = True
5+
app.config['MONGOALCHEMY_DATABASE'] = "recipes"
6+
app.config["MONGOALCHEMY_SERVER"] = "172.17.0.2"
7+
db = MongoAlchemy(app)
98

10-
}
119
from app import routes

lib/app/recipe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
class Recipe(db.Document):
7-
7+
query_class=Queries
88
title = db.StringField()
99
filename=db.StringField()
1010
ingredients=db.ListField(db.StringField())

0 commit comments

Comments
 (0)