-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
87 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from django_filters import FilterSet, BooleanFilter, CharFilter | ||
from django.forms.widgets import CheckboxInput, NullBooleanSelect | ||
from . import models, forms | ||
|
||
|
||
class DatasetFilter(FilterSet): | ||
search = CharFilter(method="filter_search", label="Full text search") | ||
my_datasets = BooleanFilter( | ||
label="My datasets", method="filter_my_datasets", widget=CheckboxInput() | ||
) | ||
public = BooleanFilter(widget=NullBooleanSelect()) | ||
|
||
def filter_my_datasets(self, queryset, name, value): | ||
if value: | ||
return queryset.filter(owner=self.request.user) | ||
return queryset | ||
|
||
def filter_search(self, queryset, name, value): | ||
if value: | ||
return queryset.search(value) | ||
return queryset | ||
|
||
class Meta: | ||
model = models.Dataset | ||
fields = {"public": ["exact"]} | ||
form = forms.DatasetFilterForm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,7 @@ | |
.dataset-metadata-section-values *:nth-child(2) { | ||
@apply col-span-3; | ||
} | ||
|
||
select { | ||
@apply pr-8 !important; | ||
} |