models.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. from email.policy import default
  2. from django.db import models
  3. from django.utils import timezone
  4. from django.template.defaultfilters import slugify
  5. class Clinique(models.Model):
  6. CLIN_Nom = models.CharField("Nom de Clinique", max_length=64, unique=True)
  7. CLIN_Anag = models.CharField("Anagrame de Clinique", max_length=3, unique=True)
  8. def __str__(self):
  9. return self.CLIN_Nom
  10. class Meta:
  11. verbose_name = "Clinique"
  12. verbose_name_plural = "Cliniques"
  13. class Batiments(models.Model):
  14. BAT_Clin = models.ForeignKey(Clinique, on_delete=models.PROTECT)
  15. BAT_Nom = models.CharField("Nom du Batiments", max_length=64, unique=True)
  16. BAT_Anag = models.CharField("Anagrame du Batiments", max_length=2, unique=True)
  17. def __str__(self):
  18. return self.BAT_Nom
  19. class Meta:
  20. verbose_name = "Batiment"
  21. verbose_name_plural = "Batiments"
  22. class Services(models.Model):
  23. SERVICE_Clin = models.ForeignKey(Clinique, on_delete=models.PROTECT)
  24. SERVICE_Nom = models.CharField("Nom du Service", max_length=64, unique=True)
  25. SERVICE_Anag = models.CharField("Anagrame du Service", max_length=2, unique=True)
  26. def __str__(self):
  27. return self.SERVICE_Nom
  28. class Meta:
  29. verbose_name = "Service"
  30. verbose_name_plural = "Services"