0

I am facing an error. I am trying out the polls tutorial as provided in the django documentation. The problem is with the django 'F' function. I am trying to update the number of votes for a choice. If I load the choice object into python memory and do the normal numeric addition it is working. But if I use choice.update(votes=F('votes')+1) then it is giving me the following error.

djongo.sql2mongo.SQLDecodeError: FAILED SQL: UPDATE "poll_choice" SET "question_id" = %(0)s, "choice_text" = %(1)s, "votes" = ("poll_choice"."votes" + %(2)s) WHERE "poll_choice"."id" = %(3)s

Params: (1, 'huntress', 1, 3)

If we observe %(2)s is supposed to be a number and not a string. But it is going as a string. Please help how I can resolve this . I am using djongo 1.2.38 with sqlparse version 0.2.4.

Debdipta Halder
  • 497
  • 1
  • 5
  • 19

0 Answers0