def __init__(self, * args, ** kwargs):
        super(PolymorphicModel, self).__init__(*args, ** kwargs)

        if self.__class__.polymorphic_super_sub_accessors_replaced:
            return
        self.__class__.polymorphic_super_sub_accessors_replaced = True

        def create_accessor_function_for_model(model, accessor_name):
            def accessor_function(self):
                attr = model.base_objects.get(pk=self.pk)
                return attr
            return accessor_function

        subclasses_and_superclasses_accessors = self._get_inheritance_relation_fields_and_models()

        try:
            from django.db.models.fields.related import ReverseOneToOneDescriptor, ForwardManyToOneDescriptor
        except ImportError:
            # django < 1.9
            from django.db.models.fields.related import (
                SingleRelatedObjectDescriptor as ReverseOneToOneDescriptor,
                ReverseSingleRelatedObjectDescriptor as ForwardManyToOneDescriptor,
            )
        for name, model in subclasses_and_superclasses_accessors.items():
            orig_accessor = getattr(self.__class__, name, None)
            if type(orig_accessor) in [ReverseOneToOneDescriptor, ForwardManyToOneDescriptor]:
                #print >>sys.stderr, '---------- replacing', name, orig_accessor, '->', model
                setattr(self.__class__, name, property(create_accessor_function_for_model(model, name)))
Prompt the user to enter an IP address or "quit" to terminate the sample.
dataset/ETHPy150Open chrisglass/django_polymorphic/polymorphic/models.py/PolymorphicModel.__init__--crossover with--dataset/ETHPy150Open ibm-security-intelligence/api-samples/siem/09_GetOffensesForIp.py/prompt_for_ip