Skip to content

Commit

Permalink
#166: Add not equal to DB where filter
Browse files Browse the repository at this point in the history
- This will match the functionality seen in the Python ICAT version of the WHERE filter, so I can put an example of this operation in the Swagger docs
  • Loading branch information
MRichards99 committed Oct 21, 2020
1 parent 7d0205c commit 6666f29
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions common/database/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def apply_filter(self, query):

if self.operation == "eq":
query.base_query = query.base_query.filter(field == self.value)
elif self.operation == "ne":
query.base_query = query.base_query.filter(field != self.value)
elif self.operation == "like":
query.base_query = query.base_query.filter(field.like(f"%{self.value}%"))
elif self.operation == "lt":
Expand Down

0 comments on commit 6666f29

Please sign in to comment.