diff --git a/sqlalchemy_continuum/plugins/flask.py b/sqlalchemy_continuum/plugins/flask.py index c7b14254..d18a9b8b 100644 --- a/sqlalchemy_continuum/plugins/flask.py +++ b/sqlalchemy_continuum/plugins/flask.py @@ -36,7 +36,7 @@ def fetch_current_user_id(): if _app_ctx_stack.top is None or _request_ctx_stack.top is None: return try: - return current_user.id + return current_user.get_id() except AttributeError: return diff --git a/tests/plugins/test_flask.py b/tests/plugins/test_flask.py index 7f962c99..24e8d960 100644 --- a/tests/plugins/test_flask.py +++ b/tests/plugins/test_flask.py @@ -1,7 +1,7 @@ import os from flask import Flask, url_for -from flask_login import LoginManager +from flask_login import LoginManager, UserMixin from flask_sqlalchemy import SQLAlchemy, _SessionSignalEvents from flexmock import flexmock @@ -76,7 +76,7 @@ def logout(self, user=None): def create_models(self): TestCase.create_models(self) - class User(self.Model): + class User(self.Model, UserMixin): __tablename__ = 'user' __versioned__ = { 'base_classes': (self.Model, )