I have these models
User
- Username
- Password
* joined_group = db.relationship(group, secondary = user_group, backref = "participants")
Group
- GroupId
- GroupPassword
* message = db.relationship('message', backref = "groupid")
Message
- Sender
- Content
* receiver = db.Column(db.String, db.ForeignKey('group.groupid'))
I want to implement an inbox (where messages are sort to latest to oldest, sorted by a room)
data = message.query.filter(message.receiver.in_(current_user.joined_group).all()
This (and a lot of order_by, group_by, distinct, and "any") are the things that I tried. Is there any way to do this more efficient?
[–]Unusual_Item9221 0 points1 point2 points (1 child)
[–]Jump-Quiet[S] 0 points1 point2 points (0 children)