我想is_active在Flask-Login中進行修改,以使用戶不總是處于活動狀態(tài)。默認值始終返回True,但我將其更改為返回banned列的值。根據文檔,is_active應該是一個屬性。但是,內部的Flask-Login代碼引發(fā)了:TypeError: 'bool' object is not callable 嘗試使用時is_active。如何正確使用is_active來停用某些用戶?class User(UserMixin, db.Model): id = db.Column(db.Integer, primary_key=True) banned = db.Column(db.Boolean, default=False) @property def is_active(self): return self.bannedlogin_user(user, form.remember_me.data)if not force and not user.is_active():TypeError: 'bool' object is not callable
Flask-Login引發(fā)TypeError:嘗試覆蓋is_active屬性時無法調用“ bool”
慕桂英3389331
2019-12-06 09:35:08