예제 #1
0
 def model_from_obj(self, obj):
     model = model_from_obj(obj)
     if not model and hasattr(obj, 'child_relation'):
         model = model_from_obj(obj.child_relation)
     if (not model and hasattr(obj, 'parent') and
             hasattr(obj.parent, 'instance') and hasattr(obj, 'source')):
         instance = obj.parent.instance
         if instance:
             if isinstance(instance, list):
                 instance = instance[0]
             model = model_from_obj(getattr(instance, obj.source))
             if not model:
                 model = type(getattr(instance, obj.source))
     return model
예제 #2
0
 def model_from_obj(self, obj):
     model = model_from_obj(obj)
     if not model and hasattr(obj, 'child_relation'):
         model = model_from_obj(obj.child_relation)
     if (not model and hasattr(obj, 'parent')
             and hasattr(obj.parent, 'instance')
             and hasattr(obj, 'source')):
         instance = obj.parent.instance
         if instance:
             if isinstance(instance, list):
                 instance = instance[0]
             model = model_from_obj(getattr(instance, obj.source))
             if not model:
                 model = type(getattr(instance, obj.source))
     return model
예제 #3
0
 def model_from_obj(self, obj):
     return model_from_obj(obj)