i want to add an 'EDIT' link for each posts on index page. but before show this link ; i need to check if session is registered. i mean i need something like this :
{% if session.name=='blabla' %}
<a href="#">Edit</a>
{% endif %}
i have django.core.context_processors.request on template context processors.
thank you
edit :
here is my detailpage view :
def singlePost(request,postslug):
post = get_object_or_404(Post, slug=postslug)
context = {'post':post}
return render_to_response('detail.html',context,context_instance = RequestContext(request))
when i try this :
def singlePost(request,postslug):
session=request.session['loggedin']
post = get_object_or_404(Post, slug=postslug)
context = {'post':post}
return render_to_response('detail.html',context,context_instance = RequestContext(request,{'session':'session',}))
it gives template syntax error ( render error)
i tried this :
{% if request.session.name=='blablabla' %}
here is the error :
TemplateSyntaxError at /post/viva-barca
Could not parse the remainder: '=='djangoo'' from 'request.session.name=='djangoo''