Show More
|
1 | 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 | 3 | {% load i18n %} |
|
4 | 4 | {% load markup %} |
|
5 | 5 | {% load cache %} |
|
6 | {% load board %} | |
|
6 | 7 | |
|
7 | 8 | {% block head %} |
|
8 | 9 | {% if tag %} |
@@ -77,7 +78,7 b'' | |||
|
77 | 78 | <div class="refmap"> |
|
78 | 79 | {% trans "Replies" %}: |
|
79 | 80 | {% for ref_post in thread.thread.referenced_posts.all %} |
|
80 |
<a href="{% url |
|
|
81 | <a href="{% post_url ref_post.id %}">>>{{ ref_post.id }}</a> | |
|
81 | 82 | {% endfor %} |
|
82 | 83 | </div> |
|
83 | 84 | {% endif %} |
@@ -131,7 +132,7 b'' | |||
|
131 | 132 | <div class="refmap"> |
|
132 | 133 | {% trans "Replies" %}: |
|
133 | 134 | {% for ref_post in post.referenced_posts.all %} |
|
134 |
<a href="{% url |
|
|
135 | <a href="{% post_url ref_post.id %}">>>{{ ref_post.id }}</a> | |
|
135 | 136 | {% endfor %} |
|
136 | 137 | </div> |
|
137 | 138 | {% endif %} |
@@ -4,6 +4,7 b'' | |||
|
4 | 4 | {% load markup %} |
|
5 | 5 | {% load cache %} |
|
6 | 6 | {% load static from staticfiles %} |
|
7 | {% load board %} | |
|
7 | 8 | |
|
8 | 9 | {% block head %} |
|
9 | 10 | <title>Neboard - {{ posts.0.get_title }}</title> |
@@ -70,7 +71,7 b'' | |||
|
70 | 71 | <div class="refmap"> |
|
71 | 72 | {% trans "Replies" %}: |
|
72 | 73 | {% for ref_post in post.referenced_posts.all %} |
|
73 |
<a href="{% url |
|
|
74 | <a href="{% post_url ref_post.id %}">>>{{ ref_post.id }}</a> | |
|
74 | 75 | {% endfor %} |
|
75 | 76 | </div> |
|
76 | 77 | {% endif %} |
General Comments 0
You need to be logged in to leave comments.
Login now