oncall-engine/engine/apps/api_for_grafana_incident/views.py
Joey Orlando 9cc74e5b67
remove references to AlertGroup.is_archived and AlertGroup.unarchived_objects (#2524)
# What this PR does

This is a follow up to #2502 which started to remove logic to
"archiving" alert groups. This PR:
- removes all references to `AlertGroup.is_archived` and marks the
column as deprecated. We will remove it in the next release
- removes the `AlertGroup.unarchived_objects` `Manager`
- renames the `AlertGroup.all_objects` `Manager` to `AlertGroup.objects`

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [ ] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-07-18 11:48:34 +00:00

19 lines
569 B
Python

from rest_framework import mixins, viewsets
from apps.alerts.models import AlertGroup
from apps.auth_token.auth import GrafanaIncidentStaticKeyAuth
from .serializers import AlertGroupSerializer
class RetrieveViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet):
"""
A viewset that provides only `retrieve` actions.
"""
class AlertGroupsView(RetrieveViewSet):
authentication_classes = (GrafanaIncidentStaticKeyAuth,)
queryset = AlertGroup.objects.all()
serializer_class = AlertGroupSerializer
lookup_field = "public_primary_key"