Re: Cannot Redirect to other page

2020-04-17 Thread pui hei Li
Thank you so much, I have fixed the problem, now I can redirect to the pages I want. *morse_logs/game2.html* {% extends "morse_logs/base.html" %} {% block content %} GAME 2 GAME 2 2 + 2 = ? {% csrf_token %} {% endblock content %} *morse_logs/v

Re: Cannot Redirect to other page

2020-04-16 Thread Gavin Wiener
I did include example, the last sentence of the first paragraph. You need to get rid of the inner function, I don't know why that was written. I needs to look more if request.method =="GET": return the regular page elif request.method == "POST": process the answers that have been sent by t

Re: Cannot Redirect to other page

2020-04-16 Thread Gavin Wiener
I did include some examples, the last sentence of the first paragraph. You need to get rid of the inner function, I don't know why it was created. It needs to look more like this if request.method == "GET": On Wednesday, April 15, 2020 at 8:22:35 PM UTC+8, pui hei Li wrote: > > I am writing a

Re: Cannot Redirect to other page

2020-04-16 Thread pui hei Li
Thank you for your reply, but I don't really understand how am i able to make it to the page I want, does it mean I need to write a new function in view and pass in the retrieved answer from user, then do the redirection/ rendering? Could you give me some hints about how the syntax would be, becaus

Re: Cannot Redirect to other page

2020-04-16 Thread Gavin Wiener
So the "return" inside the inner function won't automatically "trigger". `redirect` is a shortcut function which constructs a HttpResponseRedirect. At the moment, you're calling the function, and the HttpResponseRedirect instance is returned from the function you're not actually doing anything

Cannot Redirect to other page

2020-04-15 Thread pui hei Li
I am writing a view that retrieve an answer from game2.html, then check the answer; if the answer is correct, the view will redirect user to correct.html, if the answer is incorrect, then user will be redirected to incorrect.html. The problem now is after clicking the submit button, user won't