8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the variable name in backref:
Right now it says:
user = db.relationship("User", backref="user")
It should be:
user = db.relationship("User", backref="userbook")
full example: `class UserBook(db.Model): """ Books that the user has read and rated. """
# This is a middle table __tablename__ = "user_books" user_book_id = db.Column(db.Integer, autoincrement=True, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey("users.user_id"), nullable=False) book_id = db.Column(db.Integer, db.ForeignKey("books.book_id"), nullable=False) book_read = db.Column(db.Boolean, default=False, nullable=False) rating = db.Column(db.Integer, nullable=True) updated_at = db.Column(db.DateTime, nullable=True) book = db.relationship("Book", backref="user_books") user = db.relationship("User", backref="user") def __repr__(self): """ Provide helpful representation of ratings when printed""" return "<Book book_id=%s user_id=%s rating=%s>" % (self.book_id, self.user_id, self.rating)`
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Fix the variable name in backref:
Right now it says:
It should be:
user = db.relationship("User", backref="userbook")
full example:
`class UserBook(db.Model):
""" Books that the user has read and rated. """
The text was updated successfully, but these errors were encountered: