Add get_post_link template tag to create post backlinks

This commit is contained in:
Gergely Polonkai 2014-06-21 22:08:18 +02:00
parent ed7a61207a
commit 34d1cefe70

View File

@ -0,0 +1,8 @@
from django import template
from django.core.urlresolvers import reverse
register = template.Library()
@register.simple_tag(takes_context = True)
def get_post_link(context, post):
return context['request'].build_absolute_uri(reverse('blog:read', args=(post.created_at.year, post.created_at.month, post.created_at.day, post.slug)))