The following in part of my view file
def user_detail(request, username,
template_name='auth/user_detail.html', extra_context=None):
context = {
'user': shortcuts.get_object_or_404(User, username=username)
}
context.update(extra_context or {})
return shortcuts.render(request, template_name, context)
and a part of my template is
<ul class="nav">
{% if request.user.username != 'steve' %}
<li>
<a href="{% url 'user_detail' 'steve' %}">Steve</a>
</li>
{% endif %}
{% if request.user.username != 'james' %}
<li>
<a href="{% url 'user_detail' 'james' %}">James</a>
</li>
{% endif %}
</ul>
However even If I login using either of these users, I still get this link displayed. This is because I am checking request.user.username and the request variable is not being passed to the template by the render function.
If I directly refer as user.username then it is fine, but that is not how I want to solve this problem because there are other similar views which return this request variable that I have to use.
This is all a part of yourlabs fork of django-subscription. I have not used the render shortcut before so I do not know why I am getting this error.
Any help will be be deeply appreciated.