Implement core Epic model and API for managing project epics, enabling CRUD operations and integration with admin and DRF.
25 lines
776 B
Python
25 lines
776 B
Python
from django.db import models
|
|
|
|
|
|
class Epic(models.Model):
|
|
project = models.ForeignKey(
|
|
"projects.Project", on_delete=models.CASCADE, related_name="epics"
|
|
)
|
|
name = models.CharField(max_length=255)
|
|
description = models.TextField(blank=True, null=True)
|
|
start_date = models.DateField(blank=True, null=True)
|
|
end_date = models.DateField(blank=True, null=True)
|
|
sort_order = models.IntegerField(default=0)
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
|
|
class Meta:
|
|
db_table = "epics"
|
|
verbose_name = "Epic"
|
|
verbose_name_plural = "Epics"
|
|
ordering = ("sort_order",)
|
|
|
|
def __str__(self):
|
|
return f"[{self.project.ticket_prefix}] {self.name}"
|
|
|