Error: “dictionary update sequence element #0 has length 1; 2 is required” on Django 1.4

后端 未结 14 1106
梦如初夏
梦如初夏 2020-11-29 21:43

I have an error message on django 1.4:

dictionary update sequence element #0 has length 1; 2 is required

[EDIT]

It happe

14条回答
  •  长情又很酷
    2020-11-29 22:31

    The error should be with the params. Please verify that the params is a dictionary object. If it is just a list/tuple of arguments use only one * (*params) instead of two * (**params). This will explode the list/tuple into the proper amount of arguments.

    Or, if the params is coming from some other part of code as a JSON file, please do json.loads(params), because the JSON objects sometimes behave as string and so you need to make it as a JSON using load from string (loads).

    super(HStoreDictionary, self).__init__(value, **params)
    

    Hope this helps!

提交回复
热议问题