django content types – how to get model class of content type to create a instance?
You need to create an instance of the class. ct.model_class() returns the class, not an instance of it. Try the following: >>> from django.contrib.contenttypes.models import ContentType >>> ct = ContentType.objects.get(model=”user”) >>> ct_class = ct.model_class() >>> ct_instance = ct_class() >>> ct_instance.username=”hellow” >>> ct_instance.save()