I\'m working on forum template using Flask. When I attempt creating a new thread in the browser using forms, SQLAlchemy throws an AttributeError. The problem showed up when
the problem is this:
post = Post(body=form.body.data,
timestamp=datetime.utcnow(),
thread=thread.id,
author=g.user.id)
you want to work with ORM objects, not primary key columns:
post = Post(body=form.body.data,
timestamp=datetime.utcnow(),
thread=thread,
author=g.user)
the error means that an integer is being interpreted as an ORM object.