python: cannot concatenate 'str' and 'long' objects

前端 未结 5 1910
失恋的感觉
失恋的感觉 2020-12-11 14:34

I\'m trying to set up a choice field in django, but I don\'t think this is a django issue. The choices field takes an iterable (e.g., a list or tuple) of 2-tuples to use as

5条回答
  •  悲哀的现实
    2020-12-11 15:13

    'question_' is a string, question.id is a long. You can not concatenate two things of different types, you will have to convert the long to a string using str(question.id).

提交回复
热议问题