I am trying to pass a numerical parameter through the url to my class based Django view method get
within my class Quit
. How do I go about doing this?
.js file code...
function restart_or_quit_game(){
this.quit = function quit(number){
if(number === 1){
window.location.href='quit/1';
}
}
}
urls.py file...
urlpatterns = [
url(r'^quit/(?P<id>\d+)$', Quit.as_view()),
url(r'^$', Index.as_view()),
]
view file
class Quit(View):
def get(self, request, id):
print(id)
return redirect('/')
What am I doing wrong?