Python/Flask/LoginManager: TypeError: is_active() missing 1 required positional argument: 'self' -


i'm trying code simple login system using flask , loginmanager, keep getting error when logging in: typeerror: is_active() missing 1 required positional argument: 'self'.

full error: http://i.imgur.com/wg7ntfu.png

models.py:

class user(db.model):     id = db.column(db.integer, primary_key=true)     username = db.column(db.string(64), index=true, unique=true)     password = db.column(db.string(100), index=true, unique=true)     email = db.column(db.string(120), index=true, unique=true)     posts = db.relationship('post', backref='author', lazy='dynamic')      def is_authenticated(self):         return true      def is_active(self):         return true      def is_anonymous(self):         return false      def get_id(self):         return str(self.id)      def __repr__(self):         return '<user %r>' % (self.username) 

views.py:

login_manager = loginmanager() login_manager.init_app(app)  @login_manager.user_loader def user_loader(user_id):     user = user.query.filter_by(id=user_id)     if user.count() == 1:         return user.one()     return none  @app.route('/login', methods=['get', 'post']) def login():     form = loginform(request.form)     if request.method == 'post' , form.validate():         connectinguser = user.query.filter_by(username=form.username.data).filter_by(password=form.password.data)         if connectinguser.count() == 1:             login_user(user)             flash("successfully logged in!")             return redirect(url_for('index'))         else:              flash("wrong username/password combination...")     return render_template("login.html", form = form, title="login") 

you need pass actual instance of user - presumably 1 returned connectinguser filter - rather user class login_user function.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -