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)
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)
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
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)
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)
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)
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')
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)
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)