annotate gpp/templates/forums/display_post.html @ 314:03b70aa5c872

The home page was taking 27 seconds to load; 99% of the time was being spent in the new_posts template tag query. Reworked it a bit to be much more sane.
author Brian Neal <bgneal@gmail.com>
date Sat, 29 Jan 2011 20:34:36 +0000
parents 88b2b9cb8c1f
children 000c006fee97
rev   line source
bgneal@310 1 {% load url from future %}
bgneal@89 2 {% load avatar_tags %}
bgneal@105 3 {% load forum_tags %}
bgneal@107 4 <tr class="forum-post {% cycle 'odd' 'even' %}" id="post-{{ post.id }}">
bgneal@89 5 <td class="forum-post-author">
bgneal@89 6 <a name="p{{ post.id }}"></a>
bgneal@310 7 <a href="{% url 'bio-view_profile' username=post.user.username %}" title="View Profile for {{ post.user.username }}">{{ post.user.username }}</a><br />
bgneal@310 8 <a href="{% url 'bio-view_profile' username=post.user.username %}">{% avatar post.user %}</a>
bgneal@96 9 Joined: {{ post.user.date_joined|date:"M d, Y" }}<br />
bgneal@117 10 Posts: {{ post.user_profile.forum_post_count }}<br />
bgneal@121 11 {% if post.user_profile.location %}
bgneal@117 12 Location: {{ post.user_profile.location }}<br />
bgneal@121 13 {% endif %}
bgneal@204 14 {% for bo in post.user_profile.badge_ownership %}
bgneal@204 15 <img src="{{ bo.badge.image.url }}" alt="{{ bo.badge_count_str }}" title="{{ bo.badge_count_str }}" />
bgneal@204 16 {% endfor %}
bgneal@121 17 {% if user.is_authenticated %}
bgneal@121 18 <p>
bgneal@310 19 <a href="{% url 'messages-compose_to' post.user.username %}">
bgneal@312 20 <img src="{{ STATIC_URL }}icons/note.png" alt="PM" title="Send Private Message to {{ post.user.username }}" /></a>
bgneal@121 21 {% if not post.user_profile.hide_email %}<a href="mailto:{{ post.user.email }}">
bgneal@312 22 <img src="{{ STATIC_URL }}icons/email.png" alt="Email" title="Send Email to {{ post.user.username}}" /></a>{% endif %}
bgneal@121 23 </p>
bgneal@121 24 {% endif %}
bgneal@89 25 </td>
bgneal@89 26 <td class="forum-post-body">
bgneal@215 27 <div class="forum-post-info quiet{% if post.user_profile.is_stranger %} stranger{% endif %}">
bgneal@312 28 {% if post.unread %}<img src="{{ STATIC_URL }}icons/new.png" alt="New" title="New" />{% endif %}
bgneal@312 29 <a href="{{ post.get_absolute_url }}"><img src="{{ STATIC_URL }}icons/link.png" alt="Link" title="Link to this post" /></a>
bgneal@120 30 Posted on {% forum_date post.creation_date user %}
bgneal@310 31 {% if can_moderate %}from IP: <a href="{% url 'forums-post_ip_info' post.id %}">{{ post.user_ip }}</a>{% endif %}
bgneal@89 32 </div>
bgneal@89 33 <div class="forum-post-body">
bgneal@89 34 {{ post.html|safe }}
bgneal@121 35 {% if post.user_profile.signature_html %}
bgneal@121 36 &mdash;{{ post.user_profile.signature_html|safe }}
bgneal@121 37 {% endif %}
bgneal@113 38 {% if post.has_been_edited %}
bgneal@106 39 <p class="small quiet">Last edited: {{ post.update_date|date:"M d, Y H:i:s" }}</p>
bgneal@113 40 {% endif %}
bgneal@89 41 </div>
bgneal@285 42 {% if post.attach_list %}
bgneal@285 43 <div>
bgneal@285 44 {% for item in post.attach_list %}
bgneal@285 45 <div class="forum-attachment">{{ item.html|safe }}</div>
bgneal@285 46 {% endfor %}
bgneal@285 47 </div>
bgneal@285 48 {% endif %}
bgneal@98 49 <div class="forum-post-info-tools">
bgneal@108 50 {% if can_reply %}
bgneal@312 51 <a href="{% url 'forums-new_post' topic_id=post.topic.id %}?quote={{ post.id }}"><img src="{{ STATIC_URL }}icons/comment.png" alt="Reply with quote" title="Reply with quote" /></a>
bgneal@108 52 {% endif %}
bgneal@312 53 {% post_edit_button post user can_moderate %}
bgneal@98 54 <a href="#" class="post-flag" id="fp-{{ post.id }}"
bgneal@98 55 title="Flag this post as spam, abuse, or a violation of site rules.">
bgneal@312 56 <img src="{{ STATIC_URL }}icons/flag_red.png" alt="Flag" /></a>
bgneal@106 57 {% if can_moderate %}
bgneal@107 58 <a href="#" class="post-delete" id="dp-{{ post.id }}"
bgneal@312 59 title="Delete this post"><img src="{{ STATIC_URL }}icons/cross.png" alt="Delete post" /></a>
bgneal@215 60 {% if post.user != user and post.user_profile.is_stranger %}
bgneal@215 61 <br />
bgneal@215 62 <span class="quiet">Stranger options:</span>
bgneal@310 63 <a href="{% url 'forums-stranger' post.id %}" title="This stranger seems legitimate">
bgneal@312 64 <img src="{{ STATIC_URL }}icons/tick.png" alt="Acquaintance" /></a>
bgneal@310 65 <a href="{% url 'forums-spammer' post.id %}" title="This is spam">
bgneal@312 66 <img src="{{ STATIC_URL }}icons/exclamation.png" alt="Spammer" /></a>
bgneal@212 67 {% endif %}
bgneal@105 68 {% endif %}
bgneal@98 69 </div>
bgneal@89 70 </td>
bgneal@89 71 </tr>