Reputation: 6294
I've installed and configured django-postman
based on this documentation.
Everything is ok. Now I want to get a message list(list of unread and undeleted messages) of authenticated users in a template, but that sounds like this is just an inbox view that shows it completely (with inbox, trash, sent, received messages) while I just need a message list. Any ideas?
Upvotes: 0
Views: 930
Reputation: 6294
this is my solution:
in views.py
:
unread_messages=request.user.received_messages.filter(read_at__isnull=True,sender_deleted_at__isnull=True)
in template
:
{% for m in unread_messages %}
<!--do stuff-->
{% endfor %}
Upvotes: 1