I have two models representing movies and their show times. I would like to query for all movies, but their show_times
relationship should only contain those show times that are in the future.
class PKMovie(db.Model):
id = db.Column(db.Integer, primary_key=True)
url = db.Column(db.String(255))
show_times = db.relationship('ShowTime')
class ShowTime(db.Model):
id = db.Column(db.Integer, primary_key=True)
date = db.Column(db.Date)
pk_movie_id = db.Column(db.Integer, db.ForeignKey('pk_movie.id'))
Is it possible to affect the contents of the relationship when querying the parent?