code: def render_to_string(self, template_file, context):
          
          context = context if context else {}
          if self.object:
              context['object'] = self.object
              context[self.object.__class__.__name__.lower()] = self.object
          return render_to_string(template_file, context, self.request)
docs: Render given template to string and add object to context