How do I change the template_name in TemplateView if the user is authenticated?
Look what I've tried
class Home(TemplateView):
# template_name = 'index.html'
is_auth = False
def get(self, request):
if not request.user.is_authenticated:
self.is_auth = True
return HttpResponse('Não')
def get_template_names(self):
if self.is_auth:
return ['%s.html' % self.kwargs['template']]
# else:
# return '/crm/employee/add/'