I'm creating a web app that will manage inventory that is placed in boxes. I have installed simple history in Django.
Im trying to write a queryset that returns changes to a boxes contents and orders this data by the date in which this change of content occurred
At the moment I have in my views.py
box_content_history = Box.history.all().order_by('-history_date')
In my HTML:
<table id="table_id" class="display">
<thead>
<tr>
<th>Box</th>
<th>Content Changes</th>
<th>Date of change</th>
</tr>
</thead>
<tbody>
{% for item in box_content_history %}
<tr>
<td>{{ item.box_ref }}</td>
<td>{{ item.box_contents }}</td>
<td>{{ item.history_date }}</td>
</tr>
{% endfor %}
</tbody>
</table>
This displays the box alongside its contents and also the date it was changed. However, its still not ordering the results by this date. Is there something I can do to change this? Thank you very much in advance.