Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
Este repositório está arquivado. Pode ver ficheiros e cloná-lo, mas não pode fazer envios ou lançar questões ou pedidos de integração.

45 linhas
1.5 KiB

  1. from django.db import models
  2. from common.models import Address, NatureOfBusiness
  3. from employee.models import Employee
  4. # Create your models here.
  5. class Client(models.Model):
  6. name = models.CharField(max_length=255)
  7. email = models.EmailField(unique=True)
  8. phone_number = models.CharField(max_length=15)
  9. address = models.OneToOneField(Address, on_delete=models.SET_NULL, null=True)
  10. gstin = models.CharField(max_length=15, blank=True, null=True)
  11. cin = models.CharField(max_length=20, blank=True, null=True)
  12. nature_of_business = models.ForeignKey(NatureOfBusiness, on_delete=models.SET_NULL, null=True)
  13. def __str__(self):
  14. return self.name
  15. class Project(models.Model):
  16. client = models.ForeignKey(Client, on_delete=models.CASCADE)
  17. name = models.CharField(max_length=255)
  18. description = models.TextField()
  19. initiation_date = models.DateField()
  20. def __str__(self):
  21. return self.name
  22. class Requirement(models.Model):
  23. name = models.CharField(max_length=255)
  24. description = models.TextField()
  25. def __str__(self):
  26. return self.name
  27. class Contract(models.Model):
  28. project = models.ForeignKey(Project, on_delete=models.CASCADE)
  29. name = models.CharField(max_length=255)
  30. description = models.TextField()
  31. start_date = models.DateField()
  32. end_date = models.DateField()
  33. requirements = models.ManyToManyField(Requirement, blank=True)
  34. employees = models.ManyToManyField(Employee, blank=True)
  35. def __str__(self):
  36. return self.name