models.py 994 B

1234567891011121314151617181920212223
  1. from django.contrib.auth.models import User
  2. from django.db import models
  3. class Indicator(models.Model):
  4. """ Модель (сущность) - Измерение """
  5. id = models.AutoField(primary_key=True)
  6. type = models.ForeignKey('indicatortype.IndicatorType', on_delete=models.CASCADE)
  7. value1 = models.CharField(max_length=15)
  8. value2 = models.CharField(max_length=15, blank=True, null=True)
  9. value_added = models.DateTimeField()
  10. patient = models.ForeignKey('patient.Patient', on_delete=models.CASCADE)
  11. last_modified = models.DateTimeField(auto_now=True)
  12. comments = models.CharField(max_length=150, blank=True, null=True)
  13. observing = models.ForeignKey(User, on_delete=models.CASCADE)
  14. created_date = models.DateTimeField(auto_now_add=True)
  15. def __str__(self):
  16. return "Измерение № %s - %s" % (self.id, self.value1,)
  17. class Meta:
  18. verbose_name = "Измерение"
  19. verbose_name_plural = "Измерения"