Use request.user in class Index(TemplateView)
<p>i'm trying to implement this:</p>

<pre><code>class Index(TemplateView):
    if request.user.role == 'admin':
        template_name = 'index/admin/index.html'
    elif request.user.role == 'ff':
        template_name = 'index/firefighter/index.html'
    else:
        template_name = 'index/dev/index.html'

@method_decorator(ensure_csrf_cookie)
def dispatch(self, *args, **kwargs):
    return super(Index, self).dispatch(*args, **kwargs)
</code></pre>

<p>And i don't have idea that how implement it... Any help? This Code not work have the error: "Undefined name 'request' "</p>