Show More
@@ -36,15 +36,16 b' class ReflinkPattern(Pattern):' | |||||
36 | def handleMatch(self, m): |
|
36 | def handleMatch(self, m): | |
37 | post_id = m.group(4) |
|
37 | post_id = m.group(4) | |
38 |
|
38 | |||
39 | post = Post.objects.filter(id=post_id) |
|
39 | posts = boards.models.Post.objects.filter(id=post_id) | |
40 | if post: |
|
40 | if posts.count() > 0: | |
41 | ref_element = etree.Element('a') |
|
41 | ref_element = etree.Element('a') | |
42 |
|
42 | |||
|
43 | post = posts[0] | |||
43 | if post.thread: |
|
44 | if post.thread: | |
44 |
link = reverse(thread, kwargs={'post_id': post.thread.id}) |
|
45 | link = reverse(boards.views.thread, kwargs={'post_id': post.thread.id}) \ | |
45 |
+ '#' + post_id |
|
46 | + '#' + post_id | |
46 | else: |
|
47 | else: | |
47 | link = reverse(thread, post_id=post_id) |
|
48 | link = reverse(boards.views.thread, post_id=post_id) | |
48 |
|
49 | |||
49 | ref_element.set('href', link) |
|
50 | ref_element.set('href', link) | |
50 | ref_element.text = m.group(2) |
|
51 | ref_element.text = m.group(2) |
General Comments 0
You need to be logged in to leave comments.
Login now