Upgrade Bulma and begin drug info screen and favourites

This commit is contained in:
2024-05-17 22:47:16 +01:00
parent 4c8411b863
commit 46b1858897
20 changed files with 745 additions and 517 deletions

View File

@@ -188,7 +188,7 @@ class Dosage(models.Model):
def __str__(self):
text = (
f"{self.threshold_lower} {self.light_lower} {self.common_lower} "
"{self.strong_lower} {self.heavy_lower}"
f"{self.strong_lower} {self.heavy_lower}"
)
return f"{self.roa} {text} ({self.unit})"
@@ -409,6 +409,69 @@ class Drug(models.Model):
return f"{self.name} ({self.common_name})"
class Price(models.Model):
"""
Price of a drug.
"""
user = models.OneToOneField(User, on_delete=models.CASCADE)
amount_mg = models.IntegerField()
price_gbp = models.FloatField()
note = models.CharField(max_length=255, blank=True, null=True)
# class Stack: references, times
# class StackUnit: reference, times, dose_mg
class Favourite(models.Model):
"""
Model of a drug. Owned by a user and customisable.
"""
user = models.OneToOneField(User, on_delete=models.CASCADE)
# Nickname
nickname = models.CharField(max_length=255, blank=True, null=True)
# Prices, how much certain mass of this substance costs
prices = models.ManyToManyField(Price, blank=True, null=True)
# Internals
original = models.ForeignKey(Drug, on_delete=models.SET_NULL, blank=True, null=True)
# Below duplicates Drug
# Lysergic acid diethylamide, Phenibut
name = models.CharField(max_length=255)
# Psychedelic, Sedative, Stimulant
drug_class = models.CharField(max_length=255, blank=True, null=True)
# LSD
common_name = models.CharField(max_length=1024, blank=True, null=True)
# Factsheets, posts
links = models.ManyToManyField(Entry, blank=True)
# Dosages, how much to take to get a certain effect
dosages = models.ManyToManyField(Dosage, blank=True)
# Timings, how long to wait to reach maximum intensity (and others)
timings = models.ManyToManyField(Timing, blank=True)
# Effects, what does it do on a subjective level?
effects = models.ManyToManyField(Effect, blank=True)
# Actions, what does it do on an objective level?
actions = models.ManyToManyField(Action, blank=True)
# Experiences, what do people experience?
experiences = models.ManyToManyField(Experience, blank=True)
def __str__(self):
return f"{self.name} ({self.common_name})"
# class Perms(models.Model):
# class Meta:
# permissions = (