add tasks app
This commit is contained in:
4
core/apps/tasks/models/__init__.py
Normal file
4
core/apps/tasks/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from .column import *
|
||||
from .comment import *
|
||||
from .task import *
|
||||
from .label import *
|
||||
10
core/apps/tasks/models/column.py
Normal file
10
core/apps/tasks/models/column.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from django.db import models
|
||||
|
||||
from django_core.models import AbstractBaseModel
|
||||
|
||||
|
||||
class Column(AbstractBaseModel):
|
||||
name = models.CharField(max_length=255)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
16
core/apps/tasks/models/comment.py
Normal file
16
core/apps/tasks/models/comment.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from django.db import models
|
||||
|
||||
from django_core.models import AbstractBaseModel
|
||||
|
||||
from core.apps.tasks.choices.comment import MessageChoice
|
||||
|
||||
|
||||
class Comment(AbstractBaseModel):
|
||||
task = models.ForeignKey('tasks.Task', on_delete=models.CASCADE, related_name='comments')
|
||||
message = models.TextField()
|
||||
file = models.FileField(upload_to='comments/', blank=True, null=True)
|
||||
type = models.CharField(max_length=255, choices=MessageChoice.choices)
|
||||
created_by = models.ForeignKey('accounts.User', on_delete=models.CASCADE, related_name='comments')
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.content} created by {self.created_by}"
|
||||
10
core/apps/tasks/models/label.py
Normal file
10
core/apps/tasks/models/label.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from django.db import models
|
||||
|
||||
from django_core.models import AbstractBaseModel
|
||||
|
||||
|
||||
class Label(AbstractBaseModel):
|
||||
name = models.CharField(max_length=255)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
20
core/apps/tasks/models/task.py
Normal file
20
core/apps/tasks/models/task.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from django.db import models
|
||||
|
||||
from django_core.models import AbstractBaseModel
|
||||
|
||||
from core.apps.tasks.choices.task import PriorityChoice
|
||||
|
||||
|
||||
class Task(AbstractBaseModel):
|
||||
column = models.ForeignKey('tasks.Column', on_delete=models.CASCADE, related_name='tasks')
|
||||
name = models.CharField(max_length=255)
|
||||
description = models.TextField(blank=True)
|
||||
priority = models.CharField(max_length=255, choices=PriorityChoice.choices)
|
||||
from_date = models.DateField(null=True, blank=True)
|
||||
to_date = models.DateField(null=True, blank=True)
|
||||
labels = models.ManyToManyField('tasks.Label', related_name='tasks')
|
||||
assignees = models.ManyToManyField('accounts.User', related_name='assigned_tasks')
|
||||
created_by = models.ForeignKey('accounts.User', on_delete=models.CASCADE, related_name='created_tasks')
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.name} created by {self.created_by}"
|
||||
Reference in New Issue
Block a user