Skip to content

Commit 8b2092d

Browse files
committed
store app instance in class
1 parent f8c3bc8 commit 8b2092d

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
@@ -104,6 +104,7 @@ class MongoEngine(object):
104104
def __init__(self, app=None, config=None):
105105
_include_mongoengine(self)
106106

107+
self.app = None
107108
self.Document = Document
108109
self.DynamicDocument = DynamicDocument
109110

@@ -115,6 +116,8 @@ def init_app(self, app, config=None):
115116
if not app or not isinstance(app, Flask):
116117
raise Exception('Invalid Flask application instance')
117118

119+
self.app = app
120+
118121
app.extensions = getattr(app, 'extensions', {})
119122

120123
# Make documents JSON serializable

0 commit comments

Comments
 (0)