- {% elif thread.archived %}
-
- {% else %}
-
- {% endif %}
- {% if post.image %}
-
-
-
-
- {% endif %}
-
-
-
{{ post.title }}
-
- ({{ post.id }})
- [
{{ post.pub_time }}]
- {% if not thread.archived %}
- [
>>]
- {% endif %}
-
- {% if moderator %}
-
- [{% trans 'Delete' %}]
- ({{ post.poster_ip }})
- [{% trans 'Ban IP' %}]
-
- {% endif %}
-
- {% autoescape off %}
- {{ post.text.rendered }}
- {% endautoescape %}
- {% if post.is_referenced %}
-
- {% trans "Replies" %}:
- {% for ref_post in post.get_sorted_referenced_posts %}
-
>>{{ ref_post.id }}{% if not forloop.last %},{% endif %}
- {% endfor %}
-
- {% endif %}
-
- {% if forloop.first %}
-
- {% endif %}
-
+ {% post_view post %}
{% endfor %}
{% endcache %}
diff --git a/boards/templatetags/board.py b/boards/templatetags/board.py
--- a/boards/templatetags/board.py
+++ b/boards/templatetags/board.py
@@ -1,7 +1,7 @@
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from boards.models import Post
-from boards.views import thread
+from boards.views import thread, api
from django import template
register = template.Library()
@@ -47,3 +47,25 @@ def image_actions(*args, **kwargs):
action['name'] + ']'
return result
+
+
+@register.inclusion_tag('boards/post.html', name='post_view')
+def post_view(*args, **kwargs):
+ post = args[0]
+
+ return { 'post': post }
+
+
+@register.inclusion_tag('boards/post.html', name='post_view_truncated')
+def post_view_truncated(*args, **kwargs):
+ post = args[0]
+ if len(args) > 1:
+ need_open_link = args[1]
+ else:
+ need_open_link = False
+
+ return {
+ 'post': post,
+ 'truncated': True,
+ 'need_open_link': need_open_link
+ }
\ No newline at end of file
diff --git a/boards/views/api.py b/boards/views/api.py
--- a/boards/views/api.py
+++ b/boards/views/api.py
@@ -98,7 +98,6 @@ def get_post(request, post_id):
"""
post = get_object_or_404(Post, id=post_id)
- thread = post.thread_new
context = RequestContext(request)
context['post'] = post