You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
723 B

  1. from django_filters.rest_framework import FilterSet, BooleanFilter
  2. from .models import Document
  3. class DocumentFilter(FilterSet):
  4. seq_annotations__isnull = BooleanFilter(field_name='seq_annotations', lookup_expr='isnull')
  5. doc_annotations__isnull = BooleanFilter(field_name='doc_annotations', lookup_expr='isnull')
  6. seq2seq_annotations__isnull = BooleanFilter(field_name='seq2seq_annotations', lookup_expr='isnull')
  7. class Meta:
  8. model = Document
  9. fields = ('project', 'text', 'meta', 'created_at', 'updated_at',
  10. 'doc_annotations__label__id', 'seq_annotations__label__id',
  11. 'doc_annotations__isnull', 'seq_annotations__isnull', 'seq2seq_annotations__isnull')