filters.py 475 B

12345678910111213
  1. from django_filters import rest_framework as filters
  2. from projects.models import Project
  3. from .models import Issue
  4. class IssueFilter(filters.FilterSet):
  5. start = filters.IsoDateTimeFilter(field_name="created", lookup_expr="gte")
  6. end = filters.IsoDateTimeFilter(field_name="created", lookup_expr="lte")
  7. project = filters.ModelMultipleChoiceFilter(queryset=Project.objects.all())
  8. class Meta:
  9. model = Issue
  10. fields = ["project", "start", "end"]