File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 1
1
from recipe import Recipe
2
2
3
- class UploadDelegate :
4
3
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
Original file line number Diff line number Diff line change 1
1
from flask import Flask
2
- from flask_mongoengine import MongoEngine
2
+ from flask . ext . mongoalchemy import MongoAlchemy
3
3
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 )
9
8
10
- }
11
9
from app import routes
Original file line number Diff line number Diff line change 4
4
5
5
6
6
class Recipe (db .Document ):
7
-
7
+ query_class = Queries
8
8
title = db .StringField ()
9
9
filename = db .StringField ()
10
10
ingredients = db .ListField (db .StringField ())
You can’t perform that action at this time.
0 commit comments