Chore: replace relation choices with TextChoices in IssueRelation model (#7295)
This commit is contained in:
parent
e7d888d817
commit
f36d0691fe
1 changed files with 10 additions and 10 deletions
|
|
@ -271,15 +271,15 @@ class IssueBlocker(ProjectBaseModel):
|
||||||
return f"{self.block.name} {self.blocked_by.name}"
|
return f"{self.block.name} {self.blocked_by.name}"
|
||||||
|
|
||||||
|
|
||||||
class IssueRelation(ProjectBaseModel):
|
class IssueRelationChoices(models.TextChoices):
|
||||||
RELATION_CHOICES = (
|
DUPLICATE = "duplicate", "Duplicate"
|
||||||
("duplicate", "Duplicate"),
|
RELATES_TO = "relates_to", "Relates To"
|
||||||
("relates_to", "Relates To"),
|
BLOCKED_BY = "blocked_by", "Blocked By"
|
||||||
("blocked_by", "Blocked By"),
|
START_BEFORE = "start_before", "Start Before"
|
||||||
("start_before", "Start Before"),
|
FINISH_BEFORE = "finish_before", "Finish Before"
|
||||||
("finish_before", "Finish Before"),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
class IssueRelation(ProjectBaseModel):
|
||||||
issue = models.ForeignKey(
|
issue = models.ForeignKey(
|
||||||
Issue, related_name="issue_relation", on_delete=models.CASCADE
|
Issue, related_name="issue_relation", on_delete=models.CASCADE
|
||||||
)
|
)
|
||||||
|
|
@ -288,9 +288,9 @@ class IssueRelation(ProjectBaseModel):
|
||||||
)
|
)
|
||||||
relation_type = models.CharField(
|
relation_type = models.CharField(
|
||||||
max_length=20,
|
max_length=20,
|
||||||
choices=RELATION_CHOICES,
|
choices=IssueRelationChoices.choices,
|
||||||
verbose_name="Issue Relation Type",
|
verbose_name="Issue Relation Type",
|
||||||
default="blocked_by",
|
default=IssueRelationChoices.BLOCKED_BY,
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue