Skip to content

Commit

Permalink
Add some test code for a darkmode toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBanzon committed Nov 3, 2023
1 parent 0182c76 commit 01c381c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ACMAS/app/ACMAS_Web/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def generateContext(request):
# ACMAS homepage
def index(request):
context = generateContext(request)
request.session.set_test_cookie()
return render(request, "index.html", context)


Expand Down Expand Up @@ -209,3 +210,11 @@ def uploadManually(request):
# Do manual question upload logic
createFacade().uploadText(school, course, question, answer, assignment_type)
return render(request, "upload-manually.html", context)
def toggleDarkMode(request):
context = generateContext(request)
#There must be some way to detect which template the user is on.
current_template="index.html"
if request.session.test_cookie_worked():
print("The test cookie works")
request.session.delete_test_cookie()
return render(request,current_template,context)

0 comments on commit 01c381c

Please sign in to comment.