Mercurial > public > sg101
comparison gpp/templates/news/story_summary.html @ 399:24f1230f3ee3
Fixing #193; reduce news query counts by grabbing tags and comment counts in bulk. Increased news items per page from 5 to 10.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 26 Mar 2011 03:08:05 +0000 |
parents | c3cc431b7fb9 |
children | bbbc357ac5f3 |
comparison
equal
deleted
inserted
replaced
398:701730b2fcda | 399:24f1230f3ee3 |
---|---|
1 {% load url from future %} | 1 {% load url from future %} |
2 {% load tagging_tags %} | 2 {% load tagging_tags %} |
3 {% load comment_tags %} | 3 {% load comment_tags %} |
4 {% get_comment_count for story as comment_count %} | |
5 <div class="news-story-container solid-background"> | 4 <div class="news-story-container solid-background"> |
6 {% if on_home %} | 5 {% if on_home %} |
7 <h3><a href="{{ story.get_absolute_url }}">{{ story.title }}</a></h3> | 6 <h3><a href="{{ story.get_absolute_url }}">{{ story.title }}</a></h3> |
8 {% else %} | 7 {% else %} |
9 <h4><a href="{{ story.get_absolute_url }}">{{ story.title }}</a></h4> | 8 <h4><a href="{{ story.get_absolute_url }}">{{ story.title }}</a></h4> |
25 {% endif %} | 24 {% endif %} |
26 <hr /> | 25 <hr /> |
27 <p> | 26 <p> |
28 Category: <a href="{% url 'news-category' slug=story.category.slug %}">{{ story.category.title }}</a> | 27 Category: <a href="{% url 'news-category' slug=story.category.slug %}">{{ story.category.title }}</a> |
29 <img src="{{ STATIC_URL }}icons/comments.png" alt="Comments" title="Comments" /> | 28 <img src="{{ STATIC_URL }}icons/comments.png" alt="Comments" title="Comments" /> |
30 <a href="{{ story.get_absolute_url }}">{{ comment_count }} comment{{ comment_count|pluralize }}</a> | 29 <a href="{{ story.get_absolute_url }}">{{ story.comment_count }} comment{{ story.comment_count|pluralize }}</a> |
31 <a href="{{ story.get_absolute_url }}"><img src="{{ STATIC_URL }}icons/link.png" alt="Permalink" title="Permalink" /></a> | 30 <a href="{{ story.get_absolute_url }}"><img src="{{ STATIC_URL }}icons/link.png" alt="Permalink" title="Permalink" /></a> |
32 {% if user.is_authenticated %} | 31 {% if user.is_authenticated %} |
33 <a href="{% url 'news.views.email_story' story.id %}"><img src="{{ STATIC_URL }}icons/email_go.png" | 32 <a href="{% url 'news.views.email_story' story.id %}"><img src="{{ STATIC_URL }}icons/email_go.png" |
34 alt="Send this story to a friend" title="Send this story to a friend" /></a> | 33 alt="Send this story to a friend" title="Send this story to a friend" /></a> |
35 {% endif %} | 34 {% endif %} |
36 </p> | 35 </p> |
37 {% tags_for_object story as story_tags %} | 36 {% if story.tag_list %} |
38 {% if story_tags %} | |
39 <div class="news-tags"> | 37 <div class="news-tags"> |
40 <img src="{{ STATIC_URL }}icons/tag_blue.png" alt="Tags" title="Tags" /> Tags: | 38 <img src="{{ STATIC_URL }}icons/tag_blue.png" alt="Tags" title="Tags" /> Tags: |
41 <ul> | 39 <ul> |
42 {% for tag in story_tags %} | 40 {% for tag in story.tag_list %} |
43 <li><a href="{% url 'news-tag_page' tag_name=tag %}">{{ tag }}</a></li> | 41 <li><a href="{% url 'news-tag_page' tag_name=tag %}">{{ tag }}</a></li> |
44 {% endfor %} | 42 {% endfor %} |
45 </ul> | 43 </ul> |
46 </div> | 44 </div> |
47 {% endif %} | 45 {% endif %} |