I've got 2 questions, but they are related to the same topic.
I know how to retrieve data from a for loop
using template tags
{% for status in status %}
<tr>
<td>{{ status.status}}</td>
</tr>
{% endfor %}
However when I want to retrieve a single object i get an error even when i use:
po = Status.objects.latest('id')
and remove the for loop.
I get:
'Status' object is not iterable
My questions are:
- How can I get the latest entry from the database for a given model?
- How can I setup my templates tags to allow for just a single record?