class PubSquare(db.Model):
id = db.Column(db.Integer, primary_key=True)
author_id = db.Column(db.Integer)
subject = db.Column(db.String(60))
timestamp = db.Column(db.DateTime, default=datetime.datetime.now())
the author_id
is relation to class User
.
publist = PubSquare.query.order_by(PubSquare.timestamp.desc()).all()
In jinja2,
{% for pub in publist %}
{{ pub.author_id }}
{% endfor %}
But I need to display the element in User
.
How Could I Do This?
I can't use foreignkey Because flask-migrate can't migrate models with foreignkeys. So I have to design models without foreignkeys.
I wish someone could help me, Thanks!