Answer the question
In order to leave comments, you need to log in
Relationship between models in different blueprints?
I need to link two models that are in different blueprints.
I tried to do it like this:
from app import db
from datetime import datetime
from app.user.models import User
class Chapter(db.Model):
id = db.Column(db.Integer(), primary_key=True)
add_date = db.Column(db.DateTime(), default=datetime.utcnow)
name = db.Column(db.String())
img = db.Column(db.String())
uploader_id = db.Column(db.Integer,db.ForeignKey('uploader.id'))
uploader = db.relationship('User',
backref=db.backref('uploaded_chapters', lazy=True))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question