diff --git a/chemie/stock/templates/stock/individualstock.html b/chemie/stock/templates/stock/individualstock.html index b070e6b0..bceb3ae1 100644 --- a/chemie/stock/templates/stock/individualstock.html +++ b/chemie/stock/templates/stock/individualstock.html @@ -14,6 +14,17 @@ {{name}} -

Beskrivelse: {{desc}}

+
+
+

Beskrivelse: {{desc}}

+

Value: {{value}}

+
+ +
+ + +
+ +
{% endblock content %} \ No newline at end of file diff --git a/chemie/stock/views.py b/chemie/stock/views.py index 0b9306fb..8a3974bf 100644 --- a/chemie/stock/views.py +++ b/chemie/stock/views.py @@ -26,17 +26,18 @@ def index(request): def stock_index(request, id): - stocktypes = Stocktype.objects.all() - stocktype = stocktypes.get(id = id) + stocktype = get_object_or_404(Stocktype, id = id) name = stocktype.name desc = stocktype.desc + value = stocktype.history_set.order_by("-date").first().value + #volume - #value context = { "name":name, - "desc":desc + "desc":desc, + "value":value } return render(request, "stock/individualstock.html", context)