'dict' object has no attribute 'id'

后端 未结 1 2033
遇见更好的自我
遇见更好的自我 2021-02-18 22:43

this is my code. I am trying to translate xml string into python list to be shown in html template.

self.task_xml = \"

        
1条回答
  •  日久生厌
    2021-02-18 23:14

    You are accessing the dictionary wrongly. You need to use subscript with string 'id' , Example -

    taskViewModel = TaskViewModel(task['id'], True)
    

    0 讨论(0)
提交回复
热议问题