π Task: Add Advanced Filtering and Search to Task API
π Goal
Enhance the Task API to support advanced filtering (by status, priority, category, date) and search (by title and description) using django-filter.
π§© Why This Matters
- Makes the API more powerful and user-friendly.
- Reduces frontend processing by moving filtering logic to the backend.
- Follows REST API best practices.
π§© Subtasks
β
Acceptance Criteria
π§ͺ Testing Checklist
π Resources
β
Example Implementation (for reference)
# api/filters.py
import django_filters
from tasks.models import Task
class TaskFilter(django_filters.FilterSet):
status = django_filters.CharFilter(lookup_expr='iexact')
priority = django_filters.NumberFilter()
category = django_filters.CharFilter(field_name='category__name', lookup_expr='iexact')
created_at = django_filters.DateFromToRangeFilter()
deadline = django_filters.DateFromToRangeFilter()
class Meta:
model = Task
fields = ['status', 'priority', 'category', 'created_at', 'deadline']
# api/views.py
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.filters import SearchFilter, OrderingFilter
class TaskListView(generics.ListCreateAPIView):
queryset = Task.objects.all()
serializer_class = TaskSerializer
filter_backends = [DjangoFilterBackend, SearchFilter, OrderingFilter]
filterset_class = TaskFilter
search_fields = ['title', 'description']
ordering_fields = ['created_at', 'deadline', 'priority']
ποΈ Deadline
No rush β take your time and focus on quality.
π¬ Questions?
Feel free to ask anytime. I'm here to help.
π·οΈ Labels
good first issue, enhancement, help wanted
π Task: Add Advanced Filtering and Search to Task API
π Goal
Enhance the Task API to support advanced filtering (by status, priority, category, date) and search (by title and description) using
django-filter.π§© Why This Matters
π§© Subtasks
django-filtertorequirements.txtapi/filters.pywithTaskFilterclassTaskListView(usingFilterSet)SearchFilter(search intitleanddescription)created_at,deadline,priority)β Acceptance Criteria
status,priority,category,created_at,deadlinetitleanddescriptioncreated_at,deadline,priorityπ§ͺ Testing Checklist
status(exact match)priority(numeric)category(case-insensitive)created_at(date range)deadline(date range)title(partial match)description(partial match)created_atdeadlinepriorityπ Resources
β Example Implementation (for reference)
ποΈ Deadline
No rush β take your time and focus on quality.
π¬ Questions?
Feel free to ask anytime. I'm here to help.
π·οΈ Labels
good first issue,enhancement,help wanted