Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我已django-postman根据此文档进行安装和配置。
django-postman
一切都好。现在我想在模板中获取经过身份验证的用户的消息列表(未读和未删除的消息列表),但这听起来只是一个完整显示它的收件箱视图(包含收件箱、垃圾箱、已发送、已接收消息),而我只需要一个消息列表。有任何想法吗?
这是我的解决方案:
在views.py:
views.py
unread_messages=request.user.received_messages.filter(read_at__isnull=True,sender_deleted_at__isnull=True)
在template:
template
{% for m in unread_messages %} <!--do stuff--> {% endfor %}