Skip to content

Commit

Permalink
chg: [projects_bp] Fixed query to filters projects per organization id.
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricbonhomme committed Nov 27, 2023
1 parent f83f12e commit 208c0d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion freshermeat/web/views/api/v2/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ def get(self):
query = Project.query
for arg in args:
if hasattr(Project, arg):
query = query.filter(getattr(Project, arg).ilike(f"%{args[arg]}%"))
if isinstance(args[arg], int):
query = query.filter(getattr(Project, arg) == args[arg])
else:
query = query.filter(getattr(Project, arg).ilike(f"%{args[arg]}%"))
# Filter on other attributes
if project_organization is not None:
query = query.filter(Project.organization.has(name=project_organization))
Expand Down

0 comments on commit 208c0d3

Please sign in to comment.