I have a view that creates a list of managers in the context. I want to test if a logged in user is in the list before displaying a link to the manager dashboard.
class IndexView(TemplateView): template_name = 'index.html' def get_context_data(self, **kwargs): context = super(IndexView, self).get_context_data(**kwargs) context['mgr_list'] = Manager.objects.all() # TODO: filter for expired status return context The test in the template: {% if user.is_authenticated %} <li><a href="{% url 'logout' %}">logout</a></li> {% if user.email in mgr_list %} <li><a href="{% url 'mgr_dashboard' %}">Manager Dashboard</a></li> {% endif %} {% else %} <li><a href="{% url 'register' %}">register</a></li> <li><a href="{% url 'login' %}">login</a></li> {% endif %} The correct items are displayed for the user.is_authenticated test. Just for testing I put {{mgr_list}} in my template and it displays this: [<Manager: j...@mlhim.org>, <Manager: t...@mlhim.org>] which is correct as far as the emails are concerned but I do not understand where the 'Manager:' comes from and why are they wrapped in angle brackets? This seems to be why my 'if' doesn't test correctly but I do not know what to change. Thoughts? Thanks, Tim -- MLHIM VIP Signup: http://goo.gl/22B0U ============================================ Timothy Cook, MSc +55 21 94711995 MLHIM http://www.mlhim.org Like Us on FB: https://www.facebook.com/mlhim2 Circle us on G+: http://goo.gl/44EV5 Google Scholar: http://goo.gl/MMZ1o LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3WKjJ42J4mCFENYAXiX2HS4B23oGv7vnmHGoCTJEgA%2B%3Dg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.