开发者

Dumping one class type with Django dumpdata

开发者 https://www.devze.com 2022-12-25 22:50 出处:网络
I use dumpdata to output all my apps\'s classes. One of my app has one class that never get\'s outputted and I don\'t know where to start looking to know what\'s wrong. The 开发者_如何学编程class is u

I use dumpdata to output all my apps's classes. One of my app has one class that never get's outputted and I don't know where to start looking to know what's wrong. The 开发者_如何学编程class is used regularly, every other classes in the app are dumped fine and dumpdata doesn't throw any error.

Any clue ?


You might try serializing it to json and see if you get any errors there -- maybe there's a subtle inconsistency that's messing up the serialization.

>>> from django.core import serializers
>>> from myapp.mymodels import mymodel
>>> serializers.serialize('json', mymodel.objects.all())
[...]

This might be worth a try too:

>>> serializers.serialize('python', mymodel.objects.all())
[...]
0

精彩评论

暂无评论...
验证码 换一张
取 消