Answer the question
In order to leave comments, you need to log in
How to implement compound filters in flask-sqlalchemy?
Good afternoon. There is a model:
class Place(db.Model):
# ...
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(16), nullable=False)
sector_id = db.Column(db.Integer, nullable=False)
col = db.Column(db.Integer, nullable=False)
row = db.Column(db.Integer, nullable=False)
place_type_id = db.Column(db.Integer, nullable=False)
is_blocked_for_in = db.Column(db.Boolean, nullable=False)
is_blocked_for_out = db.Column(db.Boolean, nullable=False)
last_inventorization_at = db.Column(db.DateTime, nullable=True)
# ...
for arg in request.args:
filters[arg] = request.args[arg]
places = Place.query.filter_by(**filters).all()
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