##// END OF EJS Templates
Optimized post caching a little
neko259 -
r581:63c411a6 default
parent child Browse files
Show More
@@ -1,105 +1,101 b''
1 1 {% load i18n %}
2 2 {% load board %}
3 3 {% load cache %}
4 4
5 5 {% get_current_language as LANGUAGE_CODE %}
6 6
7 {% with thread=post.thread_new %}
8 {% cache 600 post post.id thread.last_edit_time truncated moderator LANGUAGE_CODE need_open_link %}
7 {% with thread=post.thread_new bumpable=thread.can_bump %}
8 {% cache 600 post post.id post.last_edit_time thread.archived bumpable truncated moderator LANGUAGE_CODE need_open_link %}
9 9
10 10 {% with is_opening=post.is_opening %}
11 11 {% spaceless %}
12 12 {% if thread.archived %}
13 13 <div class="post archive_post" id="{{ post.id }}">
14 {% elif thread.can_bump %}
14 {% elif bumpable %}
15 15 <div class="post" id="{{ post.id }}">
16 16 {% else %}
17 17 <div class="post dead_post" id="{{ post.id }}">
18 18 {% endif %}
19 19
20 20 {% if post.image %}
21 21 <div class="image">
22 22 <a
23 23 class="thumb"
24 24 href="{{ post.image.url }}"><img
25 25 src="{{ post.image.url_200x150 }}"
26 26 alt="{{ post.id }}"
27 27 width="{{ post.image_pre_width }}"
28 28 height="{{ post.image_pre_height }}"
29 29 data-width="{{ post.image_width }}"
30 30 data-height="{{ post.image_height }}"/>
31 31 </a>
32 32 </div>
33 33 {% endif %}
34 34 <div class="message">
35 35 <div class="post-info">
36 36 <span class="title">{{ post.title }}</span>
37 {% cache 600 post_id post.id %}
38 <a class="post_id" href="{% post_url post.id %}">
39 ({{ post.id }}) </a>
40 {% endcache %}
37 <a class="post_id" href="{% post_url post.id %}">
38 ({{ post.id }}) </a>
41 39 [<span class="pub_time">{{ post.pub_time }}</span>]
42 40 {% if thread.archived %}
43 41 β€” [{{ thread.bump_time }}]
44 42 {% endif %}
45 43 {% if not truncated and not thread.archived %}
46 44 [<a href="#" onclick="javascript:addQuickReply('{{ post.id }}')
47 45 ; return false;">&gt;&gt;</a>]
48 46 {% endif %}
49 47 {% if is_opening and need_open_link %}
50 48 {% if post.thread_new.archived %}
51 49 [<a class="link" href="{% url 'thread' post.id %}">{% trans "Open" %}</a>]
52 50 {% else %}
53 51 [<a class="link" href="{% url 'thread' post.id %}#form">{% trans "Reply" %}</a>]
54 52 {% endif %}
55 53 {% endif %}
56 54
57 55 {% if moderator %}
58 56 <span class="moderator_info">
59 57 [<a href="{% url 'post_admin' post_id=post.id %}"
60 58 >{% trans 'Edit' %}</a>]
61 59 [<a href="{% url 'delete' post_id=post.id %}"
62 60 >{% trans 'Delete' %}</a>]
63 61 ({{ post.poster_ip }})
64 62 [<a href="{% url 'ban' post_id=post.id %}?next={{ request.path }}"
65 63 >{% trans 'Ban IP' %}</a>]
66 64 </span>
67 65 {% endif %}
68 66 </div>
69 67 {% autoescape off %}
70 68 {% if truncated %}
71 69 {{ post.text.rendered|truncatewords_html:50 }}
72 70 {% else %}
73 71 {{ post.text.rendered }}
74 72 {% endif %}
75 73 {% endautoescape %}
76 {% cache 600 post_replies post.id post.last_edit_time moderator LANGUAGE_CODE %}
77 {% if post.is_referenced %}
78 <div class="refmap">
79 {% trans "Replies" %}:
80 {% for ref_post in post.get_sorted_referenced_posts %}
81 <a href="{% post_url ref_post.id %}">&gt;&gt;{{ ref_post.id }}</a
82 >{% if not forloop.last %},{% endif %}
83 {% endfor %}
84 </div>
85 {% endif %}
86 {% endcache %}
74 {% if post.is_referenced %}
75 <div class="refmap">
76 {% trans "Replies" %}:
77 {% for ref_post in post.get_sorted_referenced_posts %}
78 <a href="{% post_url ref_post.id %}">&gt;&gt;{{ ref_post.id }}</a
79 >{% if not forloop.last %},{% endif %}
80 {% endfor %}
81 </div>
82 {% endif %}
87 83 </div>
88 84 {% if is_opening and thread.tags.exists %}
89 85 <div class="metadata">
90 86 {% if is_opening and need_open_link %}
91 87 {{ thread.get_images_count }} {% trans 'images' %}.
92 88 {% endif %}
93 89 <span class="tags">
94 90 {% for tag in thread.get_tags %}
95 91 <a class="tag" href="{% url 'tag' tag.name %}">
96 92 #{{ tag.name }}</a>{% if not forloop.last %},{% endif %}
97 93 {% endfor %}
98 94 </span>
99 95 </div>
100 96 {% endif %}
101 97 </div>
102 98 {% endspaceless %}
103 99 {% endwith %}
104 100 {% endcache %}
105 101 {% endwith %}
General Comments 0
You need to be logged in to leave comments. Login now