Skip to content

Commit e89cec0

Browse files
TennyZhuangwojcikstefan
authored andcommitted
store app instance in class (#261)
1 parent b5b4609 commit e89cec0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

flask_mongoengine/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class MongoEngine(object):
9999
def __init__(self, app=None, config=None):
100100
_include_mongoengine(self)
101101

102+
self.app = None
102103
self.Document = Document
103104
self.DynamicDocument = DynamicDocument
104105

@@ -109,6 +110,8 @@ def init_app(self, app, config=None):
109110
if not app or not isinstance(app, Flask):
110111
raise Exception('Invalid Flask application instance')
111112

113+
self.app = app
114+
112115
app.extensions = getattr(app, 'extensions', {})
113116

114117
# Make documents JSON serializable

0 commit comments

Comments
 (0)