-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
58 lines (47 loc) · 1.8 KB
/
models.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from django.db import models
from django.contrib.auth.models import User
class Project(models.Model):
name = models.CharField(max_length=255)
description = models.TextField()
assigned_to = models.ForeignKey(User, on_delete=models.CASCADE, default="Admin")
class Meta:
managed = True
db_table = 'projects'
class Task(models.Model):
DEVELOPMENT = 'DEV'
TESTING = 'TEST'
DEPLOYING = 'DEPLOY'
TASK_TYPES = [
(DEVELOPMENT, 'Development'),
(TESTING, 'Testing'),
(DEPLOYING, 'Deploying'),
]
project = models.ForeignKey(Project, on_delete=models.CASCADE)
task_type = models.CharField(max_length=20, choices=TASK_TYPES)
assigned_to = models.ForeignKey(User, on_delete=models.CASCADE, default="Admin")
class Meta:
managed = True
db_table = 'tasks'
"""from django.db import models
from django.contrib.auth.models import User
class Project(models.Model):
name = models.CharField(max_length=100)
description = models.TextField()
created_at = models.DateTimeField(auto_now_add=True)
assigned_to = models.ManyToManyField(User, related_name='project_assignments')
# tasks = models.ManyToManyField(Task, related_name='projects')
class Meta:
managed = True
db_table = 'projects'
class Task(models.Model):
name = models.CharField(max_length=100)
description = models.TextField()
created_at = models.DateTimeField(auto_now_add=True)
employees = models.ManyToManyField(User, related_name='employees')
is_validation_requested = models.BooleanField(default=False)
is_validation_completed = models.BooleanField(default=False)
project = models.ForeignKey(Project, related_name='tasks', on_delete=models.CASCADE)
class Meta:
managed = True
db_table = 'tasks'
"""