سؤال

I have a model Lecture with some m2m fields in it, which I would like to dump using dumpdata.

But whenever I call python manage.py dumpdata cms.lecture I get the following error

CommandError: Unable to serialize database: 'NoneType' object has no attribute '_meta'.

Is this because of the m2m-field or what could be the problem here?

My Database is MySql (version 5.6.12) and I'm using Django 1.5.1. I used Sqlite before and it worked fine.

هل كانت مفيدة؟

المحلول

Source :

Putting

self.serialize = False

into managers.py (around line 75) seems to fix the issue for me.

Edit: of course, adding it to the Field.init call as serialize=False is a much better idea.
Edit2: additionally null used to be set to True but now defaults to False and perhaps should also be added to the constructor.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top