[Fixed]-Django using pk like int in the view function

1👍

Problem in this line, you always set flag to 1:

<a href="{% url 'play_game' flag=1 %}">

Try to pass flag to the template as context variable:

context = {
    'current_user' : current_user,
    'turn' : turn,
    'flag' : flag 
}

And then inside template increase its value each time when button clicked using add filter:

<li><a href="{% url 'play_game' flag=flag|add:'1' %}"> Move </a></li>

Leave a comment