1
How do I change template_name in Templateview if user is authenticated?
Look what I 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/'