我正在研究django-userena项目。当我运行演示项目时,除了用户消息系统之外,一切都很好。每当我尝试访问用户消息链接时,它都会给我“反向匹配”错误!我尝试了一切,但没有通过它!
错误消息
NoReverseMatch at /messages/
Reverse for 'userena_umessages_detail' with arguments '('',)' and keyword arguments '{}' not found. 1 pattern(s) tried: ['messages/view/(?P<username>[\\.\\w]+)/$']
Error during template rendering
In template /home/mach/userena/django-userena/demo/demo/templates/umessages/message_list.html, error at line 21
CODE:
11 <ul id="messages" class="list-view">
12 {% for message in message_list %}
13 <li>
14 {% if message.from_user == user %}
15 <a href="{% url 'userena_umessages_detail' message.to_user.username %}">
16 <img src="{{ message.to_user.profile.get_mugshot_url }}" class="avatar" />
17 {{ message.to_user }}
18
19 {% get_unread_message_count_between user and message.to_user as unread_between_count %}
20 {% else %}
21 <a href="{% url 'userena_umessages_detail' message.from_user.username %}">
22 <img src="{{ message.from_user.profile.get_mugshot_url }}" class="avatar" />
23 {{ message.from_user }}
24
25 {% get_unread_message_count_between user and message.from_user as unread_between_count %}
26 {% endif %}
27 <p>{{ message.latest_message }}</p> <p class="date">({{ unread_between_count }} new )</p>
28 </a>
29 </li>
30 {% endfor %}
31 </ul>