Python Django: Use dumpdata for single model with m2m field and mySql

Question:

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.

Asked By: Magda

||

Answers:

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.

Answered By: Up_One
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.