old_contents: from opendebates.utils import get_site_mode
  
  
  class SiteModeMiddleware(object):
      """
      Gets or creates a SiteMode for the request, based on the hostname.
      """
  
      def process_view(self, request, view_func, view_args, view_kwargs):
          request.site_mode = get_site_mode(request)
  
new_contents: from opendebates.utils import get_site_mode
  
  
  class SiteModeMiddleware(object):
      """
      Gets or creates a SiteMode for the request, based on the hostname.
      """
  
      def process_request(self, request):
          request.site_mode = get_site_mode(request)
  
subject: Make sure that the site mode is populated on the request