comparison gpp/templates/forums/display_post.html @ 117:a3633f39f3ce

Forums: pre-select all the user profiles when displaying a topic. As it was, the template was calling get_user_profile which was causing a db hit on every post in the topic.
author Brian Neal <bgneal@gmail.com>
date Fri, 23 Oct 2009 03:09:33 +0000
parents 0ce0104c7df3
children f8f4514b806a
comparison
equal deleted inserted replaced
116:19b64e8f02a2 117:a3633f39f3ce
4 <td class="forum-post-author"> 4 <td class="forum-post-author">
5 <a name="p{{ post.id }}"></a> 5 <a name="p{{ post.id }}"></a>
6 <a href="{% url bio-view_profile username=post.user.username %}" title="View Profile for {{ post.user.username }}">{{ post.user.username }}</a><br /> 6 <a href="{% url bio-view_profile username=post.user.username %}" title="View Profile for {{ post.user.username }}">{{ post.user.username }}</a><br />
7 <a href="{% url bio-view_profile username=post.user.username %}">{% avatar post.user %}</a> 7 <a href="{% url bio-view_profile username=post.user.username %}">{% avatar post.user %}</a>
8 Joined: {{ post.user.date_joined|date:"M d, Y" }}<br /> 8 Joined: {{ post.user.date_joined|date:"M d, Y" }}<br />
9 Posts: {{ post.user.get_profile.forum_post_count }}<br /> 9 Posts: {{ post.user_profile.forum_post_count }}<br />
10 Location: {{ post.user.get_profile.location }}<br /> 10 Location: {{ post.user_profile.location }}<br />
11 </td> 11 </td>
12 <td class="forum-post-body"> 12 <td class="forum-post-body">
13 <div class="forum-post-info quiet"> 13 <div class="forum-post-info quiet">
14 {% if post.unread %}<img src="{{ MEDIA_URL }}icons/new.png" alt="New" title="New" />{% endif %} 14 {% if post.unread %}<img src="{{ MEDIA_URL }}icons/new.png" alt="New" title="New" />{% endif %}
15 <a href="{{ post.get_absolute_url }}"><img src="{{ MEDIA_URL }}icons/link.png" alt="Link" title="Link to this post" /></a> 15 <a href="{{ post.get_absolute_url }}"><img src="{{ MEDIA_URL }}icons/link.png" alt="Link" title="Link to this post" /></a>