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