Add get_post_link template tag to create post backlinks
This commit is contained in:
parent
ed7a61207a
commit
34d1cefe70
8
blog/templatetags/blog_link.py
Normal file
8
blog/templatetags/blog_link.py
Normal 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)))
|
Loading…
Reference in New Issue
Block a user