parameters: (request)
return_statement: return render(request, "setup_wizard/mode.html", context=context)
docstring: Shows the enable/disable hardware toggle.
docstring_summary: Shows the enable/disable hardware toggle.
docstring_tokens: Shows the enable / disable hardware toggle .
function: def mode(request):
      """Shows the enable/disable hardware toggle."""
      context = {}
  
      if request.method == "POST":
          if "enable_sensing" in request.POST:
              response = redirect("setup_accounts")
              response.set_cookie("kb_setup_enable_sensing", "True")
              return response
          elif "disable_sensing" in request.POST:
              response = redirect("setup_site_settings")
              response.set_cookie("kb_setup_enable_sensing", "False")
              response.set_cookie("kb_setup_enable_users", "False")
              return response
          else:
              messages.error(request, "Unknown response.")
  
      return render(request, "setup_wizard/mode.html", context=context)
function_tokens: def mode ( request ) : context = { } if request . method == "POST" : if "enable_sensing" in request . POST : response = redirect ( "setup_accounts" ) response . set_cookie ( "kb_setup_enable_sensing" , "True" ) return response elif "disable_sensing" in request . POST : response = redirect ( "setup_site_settings" ) response . set_cookie ( "kb_setup_enable_sensing" , "False" ) response . set_cookie ( "kb_setup_enable_users" , "False" ) return response else : messages . error ( request , "Unknown response." ) return render ( request , "setup_wizard/mode.html" , context = context )