annotate gpp/templates/news/story.html @ 552:9e42e6618168

For bitbucket issue #2, tweak the admin settings for the Post model to reduce slow queries. Define our own queryset() method so we can control the select_related(), and not have it cascade from post to topics to forums to categories. Removed 'topic' from list_display because MySQL still sucked with 2 inner joins. Now it seems to be tolerable with only one join to User.
author Brian Neal <bgneal@gmail.com>
date Wed, 25 Jan 2012 20:07:03 -0600
parents bdcce55f137e
children
rev   line source
gremmie@1 1 {% extends 'news/base.html' %}
bgneal@310 2 {% load url from future %}
gremmie@1 3 {% load tagging_tags %}
bgneal@493 4 {% load bio_tags %}
gremmie@1 5 {% load comment_tags %}
bgneal@6 6 {% load script_tags %}
bgneal@484 7 {% load core_tags %}
gremmie@1 8 {% block title %}News: {{ story.title }}{% endblock %}
bgneal@484 9 {% block custom_meta %}
bgneal@484 10 {% open_graph_meta_tags story %}
bgneal@484 11 {% endblock %}
gremmie@1 12 {% block news_css %}
bgneal@312 13 <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/comments.css" />
gremmie@1 14 {% endblock %}
gremmie@1 15 {% block custom_js %}
bgneal@6 16 {% if story.can_comment_on %}
bgneal@127 17 {% script_tags "markitup jquery-ui" %}
bgneal@312 18 <script type="text/javascript" src="{{ STATIC_URL }}js/comments.js"></script>
bgneal@6 19 {% endif %}
gremmie@1 20 {% endblock %}
bgneal@490 21 {% block begin_body %}{% include 'core/social_sharing_begin.html' %}{% endblock %}
gremmie@1 22 {% block news_content %}
bgneal@380 23 <div class="solid-background">
gremmie@1 24 <h3>{{ story.title }}</h3>
gremmie@1 25 <div class="news-details">
bgneal@493 26 Submitted by {% profile_link story.submitter.username %} on {{ story.date_submitted|date:"F d, Y" }}.
gremmie@1 27 </div>
bgneal@5 28 <hr />
gremmie@1 29 <div class="news-content">
bgneal@310 30 <a href="{% url 'news-category' slug=story.category.slug %}">
gremmie@1 31 <img src="{{ story.category.icon.url }}" alt="{{ story.category.title }}" title="{{ story.category.title }}"
gremmie@1 32 class="news-icon" /></a>
gremmie@1 33 {{ story.short_text|safe }}
gremmie@1 34 {{ story.long_text|safe }}
gremmie@1 35 <br clear="all" />
bgneal@5 36 <hr />
bgneal@24 37 <p>
bgneal@310 38 Category: <a href="{% url 'news-category' slug=story.category.slug %}">{{ story.category.title }}</a>
bgneal@312 39 <a href="{{ story.get_absolute_url }}"><img src="{{ STATIC_URL }}icons/link.png"
bgneal@24 40 alt="Story Permalink" title="Story Permalink" /></a>
bgneal@24 41 {% if user.is_authenticated %}
bgneal@312 42 <a href="{% url 'news.views.email_story' story.id %}"><img src="{{ STATIC_URL }}icons/email_go.png"
bgneal@24 43 alt="Send this story to a friend" title="Send this story to a friend" /></a>
bgneal@24 44 {% endif %}
bgneal@24 45 </p>
bgneal@205 46 {% tags_for_object story as story_tags %}
bgneal@205 47 {% if story_tags %}
gremmie@1 48 <div class="news-tags">
bgneal@312 49 <img src="{{ STATIC_URL }}icons/tag_blue.png" alt="Tags" title="Tags" /> Tags:
gremmie@1 50 <ul>
gremmie@1 51 {% for tag in story_tags %}
bgneal@310 52 <li><a href="{% url 'news-tag_page' tag_name=tag.name %}">{{ tag.name }}</a></li>
gremmie@1 53 {% endfor %}
gremmie@1 54 </ul>
gremmie@1 55 </div>
gremmie@1 56 {% endif %}
bgneal@484 57 {% social_sharing story.title story.get_absolute_url %}
gremmie@1 58 </div>
gremmie@1 59 {% get_comment_count for story as comment_count %}
gremmie@1 60 <p>This story has <span id="comment-count">{{ comment_count }}</span> comment{{ comment_count|pluralize }}.</p>
gremmie@1 61 <hr />
gremmie@1 62 {% render_comment_list story %}
gremmie@1 63 {% if story.can_comment_on %}
gremmie@1 64 <p>Leave a comment?</p>
gremmie@1 65 {% render_comment_form for story %}
gremmie@1 66 {% else %}
gremmie@1 67 <p>Comments are closed for this story. If you'd like to share your thoughts on this story
bgneal@310 68 with the site staff, you can <a href="{% url 'contact-form' %}">contact us directly</a>.</p>
gremmie@1 69 {% endif %}
bgneal@380 70 </div>
gremmie@1 71 {% endblock %}
bgneal@490 72 {% block end_body %}{% include 'core/social_sharing_end.html' %}{% endblock %}