models.py 623 B

123456789101112131415161718192021
  1. from django.db import models
  2. from apps.organizations_ext.models import Organization
  3. from glitchtip.base_models import CreatedModel
  4. class Team(CreatedModel):
  5. slug = models.SlugField()
  6. organization = models.ForeignKey(
  7. Organization, on_delete=models.CASCADE, related_name="teams"
  8. )
  9. members = models.ManyToManyField(
  10. "organizations_ext.OrganizationUser", blank=True, related_name="teams"
  11. )
  12. projects = models.ManyToManyField("projects.Project", related_name="teams")
  13. class Meta:
  14. unique_together = ("slug", "organization")
  15. def __str__(self):
  16. return self.slug