related posts added to post show
This commit is contained in:
@@ -43,7 +43,8 @@ def show(request,id=None):
|
|||||||
p=Post.objects.get(id=int(id))
|
p=Post.objects.get(id=int(id))
|
||||||
elif id != ""and not id is None:
|
elif id != ""and not id is None:
|
||||||
p=Post.objects.get(slug=(id))
|
p=Post.objects.get(slug=(id))
|
||||||
return render(request, 'posts/show.html', {"post":p,"next":get_next_dict().get(p.slug,None)})
|
similar_posts = p.tags.similar_objects()
|
||||||
|
return render(request, 'posts/show.html', {"post":p,"next":get_next_dict().get(p.slug,None), "related_posts": similar_posts})
|
||||||
|
|
||||||
# Ajax function that is called to calculate a slug from the title
|
# Ajax function that is called to calculate a slug from the title
|
||||||
def slug_calc(request):
|
def slug_calc(request):
|
||||||
|
|||||||
Reference in New Issue
Block a user