django object is not JSON serializable error after upgrading django to 1.6.5

前端 未结 3 973
生来不讨喜
生来不讨喜 2020-12-09 12:17

I have a django app which was running on 1.4.2 version and working completely fine, but recently i updated it to django 1.6.5 and facing some wierd

3条回答
  •  生来不讨喜
    2020-12-09 12:47

    After analyzing the traceback, it seems that the JSONEncoder can not serialize the instance of your Client model. Generally, you got such error if you try to serialize a model related to other models (Many2ManyField, etc.) using json or simplejson libraries.

    See this https://docs.djangoproject.com/en/dev/topics/serialization/, You can also use some 3rd-party packages such as DjangoRestFramework depending on your needs.

提交回复
热议问题