in models.py I used the has method and added id= so it can function properly

This commit is contained in:
Sylvieox 2024-05-07 04:31:04 -04:00
parent 5e710fb7f9
commit 5578e9ddad

View file

@ -274,28 +274,28 @@ class Project(db.Model):
@staticmethod @staticmethod
def filter_by_paid_by(query, paid_by=None): def filter_by_paid_by(query, paid_by=None):
if paid_by: if paid_by:
return query.filter(Bill.payer.has(paid_by)) return query.filter(Bill.payer.has(id=paid_by))
else: else:
return query return query
@staticmethod @staticmethod
def filter_by_for_what(query, for_what=None): def filter_by_for_what(query, for_what=None):
if for_what: if for_what:
return query.filter(Bill.what.has(for_what)) return query.filter(Bill.what.has(id=for_what))
else: else:
return query return query
@staticmethod @staticmethod
def filter_by_for_whom(query, for_whom=None): def filter_by_for_whom(query, for_whom=None):
if for_whom: if for_whom:
return query.filter(Bill.payed_for.has(for_whom)) return query.filter(Bill.payed_for.has(id=for_whom))
else: else:
return query return query
@staticmethod @staticmethod
def filter_by_how_much(query, how_much=None): def filter_by_how_much(query, how_much=None):
if how_much is not None: if how_much is not None:
return query.filter(Bill.amount.has(how_much)) return query.filter(Bill.amount.has(id=how_much))
else: else:
return query return query