kumify/meds/models.py

37 lines
1.5 KiB
Python
Raw Normal View History

2021-01-03 07:42:04 +00:00
from django.db import models
2021-01-04 06:39:29 +00:00
from django.contrib.auth import get_user_model
2021-01-03 07:42:04 +00:00
2021-01-04 06:39:29 +00:00
from datetime import time
class MedicationSettings(models.Model):
user = models.ForeignKey(get_user_model(), models.CASCADE)
morning_from = models.TimeField(default=time(6))
morning_till = models.TimeField(default=time(10))
noon_from = models.TimeField(default=time(12))
noon_till = models.TimeField(default=time(14))
evening_from = models.TimeField(default=time(19))
evening_till = models.TimeField(default=time(21))
night_from = models.TimeField(default=time(22))
night_till = models.TimeField(default=time(23))
notifications = models.BooleanField(default=True)
refill_reminder = models.PositiveSmallIntegerField(default=7)
class Medication(models.Model):
user = models.ForeignKey(get_user_model(), models.CASCADE)
name = models.CharField(max_length=128)
icon = models.CharField(max_length=64, default="fas fa-tablets")
supply = models.DecimalField(null=True, blank=True, max_digits=5, decimal_places=2)
default_refill = models.PositiveSmallIntegerField(null=True, blank=True)
morning = models.DecimalField(null=True, blank=True, max_digits=5, decimal_places=2)
noon = models.DecimalField(null=True, blank=True, max_digits=5, decimal_places=2)
evening = models.DecimalField(null=True, blank=True, max_digits=5, decimal_places=2)
night = models.DecimalField(null=True, blank=True, max_digits=5, decimal_places=2)
remarks = models.TextField(null=True, blank=True)