ImproperlyConfigured TemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names()'

Raised by:

django/views/generic/base.py (line 145)

Traceback (most recent call last):
  File "python2.7/site-packages/django/core/handlers/base.py", line 140, in get_response
    response = middleware_method(request, callback, callback_args, callback_kwargs)
  File "python2.7/site-packages/debug_toolbar/middleware.py", line 80, in process_view
    response = panel.process_view(request, view_func, view_args, view_kwargs)
  File "python2.7/site-packages/debug_toolbar/panels/profiling.py", line 151, in process_view
    return self.profiler.runcall(view_func, *args, **view_kwargs)
  File "private.py", line 1, in private_function
    private_function()
  File "python2.7/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "python2.7/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "private.py", line 1, in private_function
    private_function()
  File "python2.7/site-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)
  File "python2.7/site-packages/django/views/generic/base.py", line 158, in get
    return self.render_to_response(context)
  File "python2.7/site-packages/django/views/generic/base.py", line 132, in render_to_response
    template=self.get_template_names(),
  File "python2.7/site-packages/django/views/generic/base.py", line 145, in get_template_names
    "TemplateResponseMixin requires either a definition of "
ImproperlyConfigured: TemplateResponseMixin requires either a definition of 'template_name' or an implementation of 'get_template_names()'

How to reproduce

Create a view that inherits from TemplateView and don't specify neither template_name attribute nor get_template_names() method.

How to fix

Make sure your view specifies template_name attribute or implements the method get_template_names().

For examples of template_name attribute usage, see (search for template_name): https://docs.djangoproject.com/en/1.9/intro/tutorial04/

For get_template_names() expected behavior, see: https://docs.djangoproject.com/en/1.9/ref/class-based-views/mixins-simple/#django.views.generic.base.TemplateResponseMixin.get_template_names