class CollectionFilter(BaseResolweFilter): """Filter the Collection endpoint.""" data = filters.ModelChoiceFilter(queryset=Data.objects.all()) descriptor_schema = filters.RelatedFilter(DescriptorSchemaFilter) entity = filters.ModelChoiceFilter(queryset=Entity.objects.all()) descriptor_schema = filters.RelatedFilter(DescriptorSchemaFilter, name='descriptor_schema') description = filters.AllLookupsFilter() class Meta: """Filter configuration.""" model = Collection
class TenderListFilterSet(df_filters.FilterSet): location = df_filters.AllValuesMultipleFilter() source = df_filters.ModelChoiceFilter(queryset=TenderSource.objects.all()) class Meta: model = Tender fields = ['location', 'source']
class SampleFilter(CollectionFilter): """Filter the sample endpoint.""" collection = filters.ModelChoiceFilter(queryset=Collection.objects.all()) class Meta(CollectionFilter.Meta): """Filter configuration.""" model = Sample
class HomeworkSubmitFilterSet(filters.FilterSet): homework = filters.ModelChoiceFilter(queryset=teacher_homeworks) hw = filters.RelatedFilter(HomeworkFilterSet, field_name='homework', queryset=teacher_homeworks) class Meta: model = HomeworkSubmit fields = ('homework', 'hw')
class EntityFilter(CollectionFilter): """Filter the Entity endpoint.""" collection = filters.ModelChoiceFilter(queryset=Collection.objects.all()) tags = TagsFilter() class Meta(CollectionFilter.Meta): """Filter configuration.""" model = Entity
class EntityFilter(CollectionFilter): """Filter the Entity endpoint.""" collections = filters.ModelChoiceFilter(queryset=Collection.objects.all()) descriptor_completed = filters.BooleanFilter() tags = TagsFilter() class Meta(CollectionFilter.Meta): """Filter configuration.""" model = Entity fields = BaseResolweFilter.Meta.fields + ['collections', 'descriptor_completed', 'tags']
class DataFilter(BaseResolweFilter): """Filter the Data endpoint.""" collection = filters.RelatedFilter(CollectionFilter, queryset=Collection.objects.all()) entity = filters.ModelChoiceFilter(queryset=Entity.objects.all()) type = filters.CharFilter(name='process__type', lookup_expr='startswith') status = filters.CharFilter(lookup_expr='iexact') finished = filters.AllLookupsFilter() started = filters.AllLookupsFilter() process = filters.RelatedFilter(ProcessFilter, queryset=Process.objects.all()) tags = TagsFilter() parents = filters.ModelChoiceFilter(queryset=Data.objects.all()) children = filters.ModelChoiceFilter(queryset=Data.objects.all()) class Meta(BaseResolweFilter.Meta): """Filter configuration.""" model = Data fields = BaseResolweFilter.Meta.fields + [ 'collection', 'entity', 'type', 'status', 'finished', 'started', 'process', 'tags', 'parents', 'children' ]
class RelationFilter(BaseResolweFilter): """Filter the Relation endpoint.""" category = filters.CharFilter(lookup_expr='iexact') collection = filters.ModelChoiceFilter(queryset=Collection.objects.all()) type = filters.CharFilter(name='type__name') class Meta(BaseResolweFilter.Meta): """Filter configuration.""" model = Relation fields = BaseResolweFilter.Meta.fields + [ 'category', 'collection', 'type' ]
class DataFilter(BaseResolweFilter): """Filter the Data endpoint.""" collection = filters.RelatedFilter(CollectionFilter) entity = filters.ModelChoiceFilter(queryset=Entity.objects.all()) type = filters.CharFilter(name='process__type', lookup_type='startswith') status = filters.CharFilter(lookup_expr='iexact') finished = filters.AllLookupsFilter() started = filters.AllLookupsFilter() process = filters.RelatedFilter(ProcessFilter) tags = TagsFilter() class Meta: """Filter configuration.""" model = Data
class BioDataFilter(DataFilter): """Filter the data endpoint. Enable filtering data by the sample. .. IMPORTANT:: :class:`DataViewSet` must be patched before using it in urls to enable this feature: .. code:: python DataViewSet.filter_class = BioDataFilter """ sample = filters.ModelChoiceFilter(queryset=Sample.objects.all())
class BioCollectionFilter(CollectionFilter): """Filter the collection endpoint. Enable filtering collections by the sample. .. IMPORTANT:: :class:`CollectionViewSet` must be patched before using it in urls to enable this feature: .. code:: python CollectionViewSet.filter_class = BioCollectionFilter """ sample = filters.ModelChoiceFilter(queryset=Sample.objects.all())
class BioDataFilter(DataFilter): """Filter the data endpoint. Enable filtering data by the sample. .. IMPORTANT:: :class:`DataViewSet` must be patched before using it in urls to enable this feature: .. code:: python DataViewSet.filter_class = BioDataFilter """ sample = filters.ModelChoiceFilter(name='entity', queryset=Sample.objects.all()) class Meta(DataFilter.Meta): """Filter configuration.""" fields = DataFilter.Meta.fields + ['sample']
class BioCollectionFilter(CollectionFilter): """Filter the collection endpoint. Enable filtering collections by the entity. .. IMPORTANT:: :class:`CollectionViewSet` must be patched before using it in urls to enable this feature: .. code:: python CollectionViewSet.filter_class = BioCollectionFilter """ sample = filters.ModelChoiceFilter(name='entity', queryset=Sample.objects.all()) class Meta(CollectionFilter.Meta): """Filter configuration.""" fields = CollectionFilter.Meta.fields + ['sample']