Skip to content

Commit

Permalink
Create LimitFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranjprice101 committed Jul 29, 2019
1 parent 67bf964 commit a0b18a8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions common/database_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ def apply_filter(self, query):
raise BadFilterError(f" Bad filter: {self.direction}")


class LimitFilter(QueryFilter):
def __init__(self, limit_value):
self.limit_value = limit_value

def apply_filter(self, query):
query.base_query = query.base_query.limit(self.limit_value)
query.is_limited = True


def insert_row_into_table(row):
"""
Insert the given row into its table
Expand Down

0 comments on commit a0b18a8

Please sign in to comment.