remove deprecate_field usage (#5148)
This commit is contained in:
parent
e11ae8a5f7
commit
e5693531d2
2 changed files with 16 additions and 11 deletions
|
|
@ -25,6 +25,8 @@ from common.jinja_templater.apply_jinja_template import (
|
|||
from common.public_primary_keys import generate_public_primary_key, increase_public_primary_key_length
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from django.db.models.manager import RelatedManager
|
||||
|
||||
from apps.alerts.models import AlertGroup, AlertReceiveChannel, ChannelFilter
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
@ -47,6 +49,7 @@ def generate_public_primary_key_for_alert():
|
|||
|
||||
class Alert(models.Model):
|
||||
group: typing.Optional["AlertGroup"]
|
||||
resolved_alert_groups: "RelatedManager['AlertGroup']"
|
||||
|
||||
public_primary_key = models.CharField(
|
||||
max_length=20,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ from django.db import IntegrityError, models, transaction
|
|||
from django.db.models import JSONField, Q, QuerySet
|
||||
from django.utils import timezone
|
||||
from django.utils.functional import cached_property
|
||||
from django_deprecate_fields import deprecate_field
|
||||
|
||||
from apps.alerts.constants import ActionSource, AlertGroupState
|
||||
from apps.alerts.escalation_snapshot import EscalationSnapshotMixin
|
||||
|
|
@ -288,17 +287,20 @@ class AlertGroup(AlertGroupSlackRenderingMixin, EscalationSnapshotMixin, models.
|
|||
related_name="resolved_alert_groups",
|
||||
)
|
||||
|
||||
# NOTE: see https://raintank-corp.slack.com/archives/C07RGREUH4Z/p1728494111646319
|
||||
# This field should eventually be dropped as it's no longer being set/read anywhere
|
||||
resolved_by_alert = deprecate_field(
|
||||
models.ForeignKey(
|
||||
"alerts.Alert",
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
default=None,
|
||||
related_name="resolved_alert_groups",
|
||||
)
|
||||
resolved_by_alert = models.ForeignKey(
|
||||
"alerts.Alert",
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
default=None,
|
||||
related_name="resolved_alert_groups",
|
||||
)
|
||||
"""
|
||||
⚠️ This field is no longer being set/read anywhere, DON'T USE IT! ⚠️
|
||||
|
||||
TODO: We still need to figure out how to remove it safely.
|
||||
|
||||
See [this conversation](https://raintank-corp.slack.com/archives/C07RGREUH4Z/p1728494111646319) for more context
|
||||
"""
|
||||
|
||||
resolved_at = models.DateTimeField(blank=True, null=True)
|
||||
acknowledged = models.BooleanField(default=False)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue