[Django]-MultipleObjectsReturned – get() returned more than one ContentType β€” it returned 2

4πŸ‘

I just met this problem.

in your database, there is a table named django_content_type.

because u have some older content_type with the same name.

u can use the sqlitebrowser to delete these.

πŸ‘€sandor ZHAO

0πŸ‘

If you want to debug, I suggest you to used filter instead of get.

In your view:

content_type = ContentType.objects.filter(model=c_type)
print(content_type)

Now in content_type you will have your 2 objects.

πŸ‘€Wilfried

Leave a comment