##// END OF EJS Templates
Removed strange 'exists' method in post manager, fixed tests in which it was...
Removed strange 'exists' method in post manager, fixed tests in which it was used

File last commit:

r322:6b051ab1 default
r396:0d260248 default
Show More
board.py
22 lines | 565 B | text/x-python | PythonLexer
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 django import template
register = template.Library()
@register.simple_tag(name='post_url')
def post_url(*args, **kwargs):
post_id = args[0]
post = get_object_or_404(Post, id=post_id)
if post.thread:
link = reverse(thread, kwargs={'post_id': post.thread.id}) \
+ '#' + str(post_id)
else:
link = reverse(thread, kwargs={'post_id': post_id})
return link