diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/querysetfilter.py')
-rw-r--r-- | bitbake/lib/toaster/toastergui/querysetfilter.py | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/bitbake/lib/toaster/toastergui/querysetfilter.py b/bitbake/lib/toaster/toastergui/querysetfilter.py deleted file mode 100644 index 10cc988bce..0000000000 --- a/bitbake/lib/toaster/toastergui/querysetfilter.py +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | class QuerysetFilter(object): | ||
2 | """ Filter for a queryset """ | ||
3 | |||
4 | def __init__(self, criteria=None): | ||
5 | self.criteria = None | ||
6 | if criteria: | ||
7 | self.set_criteria(criteria) | ||
8 | |||
9 | def set_criteria(self, criteria): | ||
10 | """ | ||
11 | criteria is an instance of django.db.models.Q; | ||
12 | see https://docs.djangoproject.com/en/1.9/ref/models/querysets/#q-objects | ||
13 | """ | ||
14 | self.criteria = criteria | ||
15 | |||
16 | def filter(self, queryset): | ||
17 | """ | ||
18 | Filter queryset according to the criteria for this filter, | ||
19 | returning the filtered queryset | ||
20 | """ | ||
21 | if self.criteria: | ||
22 | return queryset.filter(self.criteria) | ||
23 | else: | ||
24 | return queryset | ||