IMPORTANT: This question is no longer relevant.
In Django 1.7 migration, I am trying to create Commentary comments programmatically with the following code:
And an error occurs: TypeError: 'content_object' is an invalid keyword argument for this function
However, the same code (i.e. Comment(content_object=comment.booking) ) works when executed in the shell.
I tried to create an empty model using new = Comment() and then set all the required fields manually, but even if I set the content_type and object_pk respectively, they were not actually saved by content_type , and I got django.db.utils.IntegrityError: null value in column "content_type_id" violates not-null constraint
Any idea how to properly create a model with a shared foreign key when migrating? Or any workaround?
source share