Skip to content

Commit 944ee55

Browse files
mongo configuration
Further configuration of the mongo alchemy process
1 parent 4440e2a commit 944ee55

File tree

7 files changed

+26
-18
lines changed

7 files changed

+26
-18
lines changed

lib/app/CreationModificationDelegate.py

Whitespace-only changes.

lib/app/IngredientsDelegate.py

Whitespace-only changes.

lib/app/RecipeQuery.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from flask.ext.mongoalchemy import BaseQuery
2+
3+
class Queries(BaseQuery):
4+
5+
def ingredientsInclude(self=[]):
6+
return self.filter(any(i in self.type.ingredients for i in ingredients))
7+
8+
def ingredientsContainAll(self,ingredients=[]):
9+
return self.filter(all(i in self.type.ingredients for i in ingredients))
10+
11+
def tagsInclude(self,tags=[]):
12+
self.filter(any(tag in self.type.tags for tag in tags))
13+
14+
def tagsIncludeAll(self,tags=[]):
15+
return self.filter(all(tag in self.type.tags for tag in tags))
16+
17+
def titleIsLike(self,match):
18+
return self.filter(match in self.type.title)

lib/app/TagsDelegate.py

Whitespace-only changes.

lib/app/TitleDelegate.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from recipe import Recipe
2+
3+
class UploadDelegate:
4+
5+
def __init__(self):
6+

lib/app/dao/query/RecipeQuery.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

lib/app/dao/recipe.py renamed to lib/app/recipe.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import json
2+
from RecipeQuery import Queries
23
from app import db
34

45

56
class Recipe(db.Document):
7+
68
title = db.StringField()
79
filename=db.StringField()
810
ingredients=db.ListField(db.StringField())

0 commit comments

Comments
 (0)