Merge pull request #506 from grafana/matiasb/schedules-name-search-filter

Add name search filter to schedules API
This commit is contained in:
Matias Bordese 2022-09-08 08:57:52 -03:00 committed by GitHub
commit 70848425fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,6 +8,7 @@ from django.utils.functional import cached_property
from rest_framework import status
from rest_framework.decorators import action
from rest_framework.exceptions import NotFound
from rest_framework.filters import SearchFilter
from rest_framework.permissions import IsAuthenticated
from rest_framework.views import Response
from rest_framework.viewsets import ModelViewSet
@ -63,6 +64,8 @@ class ScheduleView(
"related_escalation_chains",
),
}
filter_backends = [SearchFilter]
search_fields = ("name",)
queryset = OnCallSchedule.objects.all()
serializer_class = PolymorphicScheduleSerializer