Commit a8692850 authored by freetux's avatar freetux

fix reverse show weights

parent f0a3e883
Pipeline #32505060 failed with stages
in 1 minute and 36 seconds
......@@ -250,14 +250,14 @@ class WeightList(ListView):
def get_context_data(self, **kwargs):
# Call the base implementation first to get a context
context = super().get_context_data(**kwargs)
weights = Weight.objects.filter(user = self.request.user)
weights = Weight.objects.filter(user = self.request.user).order_by('-date_created')
weight = weights.values('weight',)
if weight :
height = weights.values('height',)
person = User.objects.get(id= self.request.user.id)
lastest_weight = weight.order_by('-id')[0]["weight"]
lastest_height = height.order_by('-id')[0]["height"]
lastest_weight = weight.order_by('-date_created')[0]["weight"]
lastest_height = height.order_by('-date_created')[0]["height"]
bmi = self.bmi(lastest_weight, lastest_height)
lhi = self.toinch(lastest_height)
gender = person.gender
......
......@@ -44,11 +44,7 @@
</tr>
</thead>
<tbody>
<<<<<<< HEAD
{% for drug in drugs %}
=======
{% for drug in object_list %}
>>>>>>> 32c26fc420f6afb5ac788df9a4c94ca5aaf65572
<tr>
<td>{{ drug.id }}</td>
......@@ -79,7 +75,7 @@
<li class="active"><span>{{ i }} <span class="sr-only">(current)</span></span></li>
{% else %}
<li class="page-item"><a class="page-link" href="?page={{ i }}">{{ i }}</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}">&raquo; بعد</a></li>
......
......@@ -128,11 +128,11 @@
</tr>
</thead>
<tbody>
{% for weight in object_list %}
{% for weight in weights %}
<tr>
<td>{{ weight.id }}</td>
<td>{{ weight.date_created|jformat:"%A %d %B %Y %H:%M" }}</td>
<td>{{ weight.date_created|jformat:"%d %B %Y" }}</td>
<td>{{ weight.weight|floatformat }}</td>
<td>{{ weight.height|floatformat }}</td>
<td>{{ weight.text }}</td>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment