Пример #1
0
class Notification(models.Model):
    notifier_type = models.CharField(max_length=30)
    notifier = models.IntegerField()
    receivers = models.ManyToManyField(CustomUser,
                                       through='UserNotification',
                                       through_fields=('notification', 'user'))
    created_at = models.DateField(default=timezone.now)
    updated_at = AutoDateTimeField(default=timezone.now)
Пример #2
0
class Assignee(models.Model):
    user = models.ForeignKey(CustomUser,
                             on_delete=models.CASCADE,
                             related_name="user_to_task")
    task = models.ForeignKey('Task',
                             on_delete=models.CASCADE,
                             related_name="task_to_user")
    created_at = models.DateField(default=timezone.now)
    updated_at = AutoDateTimeField(default=timezone.now)
Пример #3
0
class Preferences(models.Model):
    language = models.CharField(max_length=2)
    color_schema = models.CharField(max_length=1)
    user = models.OneToOneField(CustomUser, on_delete=models.CASCADE)
    created_at = models.DateField(default=timezone.now)
    updated_at = AutoDateTimeField(default=timezone.now)

    def __str__(self):
        return self.language
Пример #4
0
class UserNotification(models.Model):
    user = models.ForeignKey(CustomUser,
                             on_delete=models.CASCADE,
                             related_name="user_to_notification")
    notification = models.ForeignKey('Notification',
                                     on_delete=models.CASCADE,
                                     related_name="notification_to_user")
    created_at = models.DateField(default=timezone.now)
    updated_at = AutoDateTimeField(default=timezone.now)
Пример #5
0
class Task(models.Model):
    title = models.CharField(max_length=30)
    description = models.TextField()
    due_date = models.DateField(auto_now=False, auto_now_add=False)
    priority = models.IntegerField()
    task_file = models.FileField(upload_to=tasks_directory_path, blank=True)
    board = models.ForeignKey('Board', on_delete=models.CASCADE)
    assigned_users = models.ManyToManyField(CustomUser, through='Assignee')
    created_at = models.DateField(default=timezone.now)
    updated_at = AutoDateTimeField(default=timezone.now)
Пример #6
0
class UserProject(models.Model):
    user = models.ForeignKey(CustomUser,
                             on_delete=models.CASCADE,
                             related_name="user_to_project")
    project = models.ForeignKey('Project',
                                on_delete=models.CASCADE,
                                related_name="project_to_user")
    role = models.CharField(max_length=30)
    status = models.CharField(max_length=10)
    created_at = models.DateField(default=timezone.now)
    updated_at = AutoDateTimeField(default=timezone.now)
Пример #7
0
class Project(models.Model):
    title = models.CharField(max_length=30)
    description = models.TextField()
    project_photo = models.ImageField(upload_to=project_directory_path,
                                      blank=True,
                                      null=True)
    creator = models.ForeignKey(CustomUser,
                                on_delete=models.CASCADE,
                                related_name="project_creator")
    created_at = models.DateField(default=timezone.now)
    updated_at = AutoDateTimeField(default=timezone.now)
    assignee = models.ManyToManyField(CustomUser, through='UserProject')
Пример #8
0
class Comment(models.Model):
    text = models.TextField()
    task = models.ForeignKey('Task', on_delete=models.CASCADE)
    creator = models.ForeignKey(CustomUser, on_delete=models.CASCADE)
    created_at = models.DateField(default=timezone.now)
    updated_at = AutoDateTimeField(default=timezone.now)
Пример #9
0
class Board(models.Model):
    title = models.CharField(max_length=10)
    project = models.ForeignKey('Project', on_delete=models.CASCADE)
    created_at = models.DateField(default=timezone.now)
    updated_at = AutoDateTimeField(default=timezone.now)