Created
July 12, 2023 09:50
-
-
Save rg3915/9ffdbb80046e07cf951f641a13599847 to your computer and use it in GitHub Desktop.
get_issues
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sprint(UuidModel, TimeStampedModel): | |
title = models.CharField(max_length=100, null=True, blank=True) | |
project = models.ForeignKey( | |
Project, | |
on_delete=models.CASCADE, | |
related_name='sprints', | |
) | |
def get_issues(self): | |
return self.issue_set.all() | |
class Issue(TimeStampedModel, UuidModel): | |
number = models.PositiveIntegerField() | |
title = models.CharField(max_length=255) | |
sprint = models.ForeignKey( | |
Sprint, | |
on_delete=models.CASCADE, | |
) | |
class Project(TimeStampedModel, Active): | |
title = models.CharField(max_length=255, unique=True) | |
def get_sprints(self): | |
return self.sprints.all() | |
def get_issues(self): | |
return [sprint.get_issues() for sprint in self.get_sprints()] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment