0
我已經宣佈了一些類崗位與方法函數來檢查自己,但顯然SQLAlchemy的是不承認它:的SQLAlchemy類方法錯誤
t.checkprofanity()
AttributeError: 'post' object has no attribute 'checkprofanity'
我通過導入類:
Base = automap_base()
Base.prepare(engine, reflect=True)
try:
Post = Base.classes.post
這裏是類
class Post(db.Model):
...
@classmethod
def checkprofanity(self):
...
def __repr__(self):
return '<Post %r>' % (self.id)
你的'__repr__'確實有效嗎? – API
打印(t)輸出 –
jmrueda
t不給出輸出 – jmrueda