def create_generic(self, content_object=None, **kwargs):
        """Create a generic object.

        :param content_object: the content object to create a new object for.
        """
        if content_object:
            kwargs['content_type'] = ContentType.objects.get_for_model(
                content_object
            )
            kwargs['object_id'] = content_object.id

        return self.create(**kwargs)
def create_generic ( self , content_object = None , ** kwargs ) : if content_object : kwargs [ 'content_type' ] = ContentType . objects . get_for_model ( content_object ) kwargs [ 'object_id' ] = content_object . id return self . create ( ** kwargs )
Create a generic object.

        :param content_object: the content object to create a new object for.