def add_lazy_relation(cls, field, relation, operation):
 if (relation == RECURSIVE_RELATIONSHIP_CONSTANT):
  app_label = cls._meta.app_label
  model_name = cls.__name__
 else:
  try:
   (app_label, model_name) = relation.split('.')
  except ValueError:
   app_label = cls._meta.app_label
   model_name = relation
  except AttributeError:
   app_label = relation._meta.app_label
   model_name = relation._meta.object_name
 model = get_model(app_label, model_name, seed_cache=False, only_installed=False)
 if model:
  operation(field, model, cls)
 else:
  key = (app_label, model_name)
  value = (cls, field, operation)
  pending_lookups.setdefault(key, []).append(value)

def add_lazy_relation ( cls , field , relation , operation ) : if ( relation == RECURSIVE_RELATIONSHIP_CONSTANT ) : app_label = cls . _meta . app_label model_name = cls . __name__ else : try : ( app_label , model_name ) = relation . split ( '.' ) except ValueError : app_label = cls . _meta . app_label model_name = relation except AttributeError : app_label = relation . _meta . app_label model_name = relation . _meta . object_name model = get_model ( app_label , model_name , seed_cache = False , only_installed = False ) if model : operation ( field , model , cls ) else : key = ( app_label , model_name ) value = ( cls , field , operation ) pending_lookups . setdefault ( key , [ ] ) . append ( value )
adds a lookup on cls when a related field is defined using a string .