0

I want to filter data. My logic is --> filter_by(status_id = 1 or 3) How can I do that?

@users.route("/user/<int:user_id>")
def user(user_id):
    user = User.query.filter_by(id=user_id).first_or_404()
    listings = Listing.query.filter_by(user_id=current_user.id, status_id = 1)\
                .order_by(Listing.date_posted.desc()).all()
    return render_template('user.html', user=user, listings=listings)
Rajesh
  • 30
  • 7
  • you want [this](https://docs.sqlalchemy.org/en/13/orm/tutorial.html#common-filter-operators) or [this](https://stackoverflow.com/questions/7942547/using-or-in-sqlalchemy) – Andrew Allen May 02 '19 at 15:44
  • Thank you @AndrewAllen for your help. – Rajesh May 16 '19 at 21:25

0 Answers0