Django filer - PolymorphicTypeInvalid ContentType 37 does not point to a subclass

560 Views Asked by At

I am using django-filer to handle uploading images in my Django app. I am currently trying to load data from MySQL to PostgreSQL database.

I have used the following commands to get data from MySQL and move it t PostgreSQL:

python manage.py dumpdata myapp> myapp.json
set DJANGO_SETTINGS_MODULE=myproject.settings.production
python manage.py loaddata "myapp.json"

All content works fine and I can see in pgAdmin4 that it's been successfully exported however when I am trying to open a website that contains images I get Internal Server Error like this:

PolymorphicTypeInvalid at /myapp/homepage
ContentType 37 for <class 'django_comments_xtd.models.BlackListedDomain'> #205 does not point to a subclass!

Or error like this:

PolymorphicTypeInvalid at /admin/myapp/articles/30/change/ ContentType 37 for <class 'django_comments_xtd.models.BlackListedDomain'> #232 does not point to a subclass!

How can I get rid of this error and how can I move all image paths from MySQL to PostgreSQL?

1

There are 1 best solutions below

0
On

I finally found the solution. The id in old db in django_contenttype table was 37 and in my new db the id is 73. The only thing to do was to change in json file content type id.