class ProjectManager(TenantModel): project = TenantForeignKey(Project, on_delete=models.CASCADE, related_name='projectmanagers') manager = TenantForeignKey(Manager, on_delete=models.CASCADE) account = models.ForeignKey(Account, on_delete=models.CASCADE) tenant_id = 'account_id'
class SubTask(TenantModel): name = models.CharField(max_length=255) type = models.CharField(max_length=255) account = models.ForeignKey(Account, on_delete=models.CASCADE) task = TenantForeignKey(Task, on_delete=models.CASCADE) project = TenantForeignKey(Project, on_delete=models.CASCADE, null=True) tenant_id = 'account_id'
class Task(TenantModel): name = models.CharField(max_length=255) project = TenantForeignKey(Project, on_delete=models.CASCADE, related_name='tasks') account = models.ForeignKey(Account, on_delete=models.CASCADE) tenant_id = 'account_id'
class Revenue(TenantModel): # To test for correct tenant_id push down in query acc = models.ForeignKey(Account, on_delete=models.CASCADE, related_name="revenues") project = TenantForeignKey(Project, on_delete=models.CASCADE, related_name="revenues") value = models.CharField(max_length=30) tenant_id = "acc_id"
class Task(TenantModelMixin, models.Model): name = models.CharField(max_length=255) project = TenantForeignKey(Project, on_delete=models.CASCADE, related_name="tasks") account = models.ForeignKey(Account, on_delete=models.CASCADE) opened = models.BooleanField(default=True) parent = TenantForeignKey("self", on_delete=models.CASCADE, db_index=False, blank=True, null=True) objects = TaskManager() tenant_id = "account_id" def __str__(self): return "{} ({})".format(self.name, self.project)
class Task(TenantModelMixin, models.Model): name = models.CharField(max_length=255) project = TenantForeignKey(Project, on_delete=models.CASCADE, related_name='tasks') account = models.ForeignKey(Account, on_delete=models.CASCADE) opened = models.BooleanField(default=True) objects = TaskManager() tenant_id = 'account_id' def __str__(self): return "{} ({})".format(self.name, self.project)
class Record(TenantModel): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) name = models.CharField(max_length=255) organization = TenantForeignKey(Organization, on_delete=models.CASCADE) tenant_id = 'organization_id'
class AliasedTask(TenantModel): project_alias = TenantForeignKey(Project, on_delete=models.CASCADE) account = models.ForeignKey(Account, on_delete=models.CASCADE) tenant_id = 'account_id'