diff --git a/core/models.py b/core/models.py index 698a265..ae2f739 100644 --- a/core/models.py +++ b/core/models.py @@ -469,7 +469,7 @@ class Favourite(models.Model): experiences = models.ManyToManyField(Experience, blank=True) def __str__(self): - return f"{self.name} ({self.common_name})" + return f"{self.name} [{self.nickname}] ({self.common_name})" # class Perms(models.Model): diff --git a/core/templates/partials/drug-detail.html b/core/templates/partials/drug-detail.html index 436a1c0..8df3367 100644 --- a/core/templates/partials/drug-detail.html +++ b/core/templates/partials/drug-detail.html @@ -6,7 +6,7 @@ {% include 'mixins/partials/notify.html' %} {% if object is not None %} -

{{ object.name }} - {{ object.nickname }} - {{ object.common_name }}

+

{{ object }}

{{ object.drug_class }}

Prices @@ -16,29 +16,171 @@

Dosage

-
    - {% for dose in object.dosages.all %} -
  • {{ dose }}
  • - {% endfor %} -
+ + + {% for item in object.dosages.all %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% endfor %} + + +
roa + {{ item.roa }} +
unit + {{ item.unit }} +
threshold + {{ item.threshold_lower }} - {{ item.threshold_upper }} +
light + {{ item.light_lower }} - {{ item.light_upper }} +
common + {{ item.common_lower }} - {{ item.common_upper }} +
strong + {{ item.strong_lower }} - {{ item.strong_upper }} +
heavy + {{ item.heavy_lower }} - {{ item.heavy_upper }} +

Timing

-
    - {% for timing in object.timings.all %} -
  • {{ timing }}
  • - {% endfor %} -
+ + + {% for item in object.timings.all %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% endfor %} + +
roa + {{ item.roa }} +
unit + {{ item.unit }} +
onset + {{ item.onset_lower }} - {{ item.onset_upper }} +
comeup + {{ item.comeup_lower }} - {{ item.comeup_upper }} +
peak + {{ item.peak_lower }} - {{ item.peak_upper }} +
offset + {{ item.offset_lower }} - {{ item.offset_upper }} +
total + {{ item.total_lower }} - {{ item.total_upper }} +

Links

-
    - {% for link in object.links.all %} -
  • {{ link }}
  • - {% endfor %} -
+ + + {% for item in object.links.all %} + + + + + + + + + + + + + + + + + {% endfor %} + +
source + {{ item.source }} +
url + {{ item.url }} +
author + {{ item.author }} +
@@ -54,11 +196,39 @@

Effects

- + + + {% for item in object.effects.all %} + + + + + + + + + + + + {% endfor %} + +
entry + {{ item.entry.url }} +
SEI +
+ {% for effect in item.subjective_effects.all %} +
+ {{ effect }} +
+ {% endfor %} +
+
diff --git a/core/views/drugs.py b/core/views/drugs.py index 11f00ce..a8d2f6e 100644 --- a/core/views/drugs.py +++ b/core/views/drugs.py @@ -65,14 +65,9 @@ class DrugDetail(LoginRequiredMixin, StaffMemberRequiredMixin, ObjectRead): detail_url_args = ["type", "pk"] def get_object(self, **kwargs): - print("GET") pk = kwargs.get("pk") info = Drug.objects.get(pk=pk) - - # self.extra_context = {} - print("info", info) - # return dictionary - return info.__dict__ + return info class DrugClear(LoginRequiredMixin, StaffMemberRequiredMixin, APIView): diff --git a/core/views/favourites.py b/core/views/favourites.py index 74306d3..b2b028c 100644 --- a/core/views/favourites.py +++ b/core/views/favourites.py @@ -53,7 +53,7 @@ class FavouriteDetail(LoginRequiredMixin, ObjectRead): def get_object(self, **kwargs): pk = kwargs.get("pk") info = Favourite.objects.get(pk=pk, user=self.request.user) - return info.__dict__ + return info # class FavouriteClear(LoginRequiredMixin, APIView):