##// END OF EJS Templates
Added a template tag to get post link instead of using jumper
neko259 -
r320:e8a3c65d default
parent child Browse files
Show More
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
@@ -0,0 +1,22 b''
1 from django.core.urlresolvers import reverse
2 from django.shortcuts import get_object_or_404
3 from boards.models import Post
4 from boards.views import thread
5 from django import template
6
7 register = template.Library()
8
9
10 @register.simple_tag(name='post_url')
11 def post_url(*args, **kwargs):
12 post_id = args[0]
13
14 post = get_object_or_404(Post, id=post_id)
15
16 if post.thread:
17 link = reverse(thread, kwargs={'post_id': post.thread.id}) \
18 + '#' + str(post_id)
19 else:
20 link = reverse(thread, kwargs={'post_id': post_id})
21
22 return link
@@ -3,6 +3,7 b''
3 {% load i18n %}
3 {% load i18n %}
4 {% load markup %}
4 {% load markup %}
5 {% load cache %}
5 {% load cache %}
6 {% load board %}
6
7
7 {% block head %}
8 {% block head %}
8 {% if tag %}
9 {% if tag %}
@@ -77,7 +78,7 b''
77 <div class="refmap">
78 <div class="refmap">
78 {% trans "Replies" %}:
79 {% trans "Replies" %}:
79 {% for ref_post in thread.thread.referenced_posts.all %}
80 {% for ref_post in thread.thread.referenced_posts.all %}
80 <a href="{% url 'jumper' ref_post.id %}">&gt;&gt;{{ ref_post.id }}</a>
81 <a href="{% post_url ref_post.id %}">&gt;&gt;{{ ref_post.id }}</a>
81 {% endfor %}
82 {% endfor %}
82 </div>
83 </div>
83 {% endif %}
84 {% endif %}
@@ -131,7 +132,7 b''
131 <div class="refmap">
132 <div class="refmap">
132 {% trans "Replies" %}:
133 {% trans "Replies" %}:
133 {% for ref_post in post.referenced_posts.all %}
134 {% for ref_post in post.referenced_posts.all %}
134 <a href="{% url 'jumper' ref_post.id %}">&gt;&gt;{{ ref_post.id }}</a>
135 <a href="{% post_url ref_post.id %}">&gt;&gt;{{ ref_post.id }}</a>
135 {% endfor %}
136 {% endfor %}
136 </div>
137 </div>
137 {% endif %}
138 {% endif %}
@@ -4,6 +4,7 b''
4 {% load markup %}
4 {% load markup %}
5 {% load cache %}
5 {% load cache %}
6 {% load static from staticfiles %}
6 {% load static from staticfiles %}
7 {% load board %}
7
8
8 {% block head %}
9 {% block head %}
9 <title>Neboard - {{ posts.0.get_title }}</title>
10 <title>Neboard - {{ posts.0.get_title }}</title>
@@ -70,7 +71,7 b''
70 <div class="refmap">
71 <div class="refmap">
71 {% trans "Replies" %}:
72 {% trans "Replies" %}:
72 {% for ref_post in post.referenced_posts.all %}
73 {% for ref_post in post.referenced_posts.all %}
73 <a href="{% url 'jumper' ref_post.id %}">&gt;&gt;{{ ref_post.id }}</a>
74 <a href="{% post_url ref_post.id %}">&gt;&gt;{{ ref_post.id }}</a>
74 {% endfor %}
75 {% endfor %}
75 </div>
76 </div>
76 {% endif %}
77 {% endif %}
General Comments 0
You need to be logged in to leave comments. Login now