def instance_pre_init(self, signal, sender, args, kwargs, **_kwargs):
        """
        Handles initializing an object with the generic FK instaed of
        content-type/object-id fields.
        """
        if self.name in kwargs:
            value = kwargs.pop(self.name)
            kwargs[self.ct_field] = self.get_content_type(obj=value)
            kwargs[self.fk_field] = value._get_pk_val()
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/contrib/contenttypes/generic.py/GenericForeignKey.instance_pre_init/original