Skip to content

Design how incident relations should work #313

@hmpf

Description

@hmpf
class IncidentRelationType(models.Model):
    name = models.TextField()

    class Meta:
        ordering = ["name"]

    def __str__(self):
        return self.name


class IncidentRelation(models.Model):
    # "+" prevents creating a backwards relation
    incident1 = models.ForeignKey(to=Incident, on_delete=models.CASCADE, related_name="+")
    incident2 = models.ForeignKey(to=Incident, on_delete=models.CASCADE, related_name="+")
    type = models.ForeignKey(to=IncidentRelationType, on_delete=models.PROTECT, related_name="incident_relations")
    description = models.TextField(blank=True)

    def __str__(self):
        return f"Incident #{self.incident1.pk} {self.type} #{self.incident2.pk}"

See also PR #312, which so far ensures that incident1 and incident2 cannot be identical.

If name is "duplicate", str(IncidentRelation) would look something like "Incident #32 duplicate #17", which is not very useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIAffects Argus' REST APIUXUX design help needed/Improves user experiencedata modelAffects the data model and/or SQL schemadiscussionRequires developer feedback/discussion before implementationenhancementNew feature or requestfrontendAffects frontendnotificationAffects the notification systemuser feedback neededFeedback from end users required to solve this

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions