'Return a list of template names to be used for the request. May not be
called if render_to_response() is overridden. Return the following list:
* the value of ``template_name`` on the view (if provided)
* the contents of the ``template_name_field`` field on the
object instance that the view is operating upon (if available)
* ``<app_label>/<model_name><template_name_suffix>.html``'

def get_template_names(self):

    try:
        names = super().get_template_names()
    except ImproperlyConfigured:
        names = []
        if (self.object and self.template_name_field):
            name = getattr(self.object, self.template_name_field, None)
            if name:
                names.insert(0, name)
        if isinstance(self.object, models.Model):
            object_meta = self.object._meta
            names.append(('%s/%s%s.html' % (object_meta.app_label, object_meta.model_name, self.template_name_suffix)))
        elif (hasattr(self, 'model') and (self.model is not None) and issubclass(self.model, models.Model)):
            names.append(('%s/%s%s.html' % (self.model._meta.app_label, self.model._meta.model_name, self.template_name_suffix)))
        if (not names):
            raise
    return names
