David Leonard 10 年之前
父节点
当前提交
191b037619
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      hackathon_starter/hackathon/views.py

+ 7 - 0
hackathon_starter/hackathon/views.py

@@ -93,3 +93,10 @@ def user_login(request):
         # No context variables to pass to the template system, hence the
         # blank dictionary object...
         return render(request, 'hackathon/login.html', {})
+
+def user_logout(request):
+    # Since we know the user is logged in, we can now just log them out.
+    logout(request)
+
+    # Take the user back to the homepage.
+    return HttpResponseRedirect('/hackathon/')