

def add_lazy_relation(cls, field, relation, operation):
    '\n    Adds a lookup on ``cls`` when a related field is defined using a string,\n    i.e.::\n\n        class MyModel(Model):\n            fk = ForeignKey("AnotherModel")\n\n    This string can be:\n\n        * RECURSIVE_RELATIONSHIP_CONSTANT (i.e. "self") to indicate a recursive\n          relation.\n\n        * The name of a model (i.e "AnotherModel") to indicate another model in\n          the same app.\n\n        * An app-label and model name (i.e. "someapp.AnotherModel") to indicate\n          another model in a different app.\n\n    If the other model hasn\'t yet been loaded -- almost a given if you\'re using\n    lazy relationships -- then the relation won\'t be set up until the\n    class_prepared signal fires at the end of model initialization.\n\n    operation is the work that must be performed once the relation can be resolved.\n    '
    if (relation == RECURSIVE_RELATIONSHIP_CONSTANT):
        app_label = cls._meta.app_label
        model_name = cls.__name__
    elif isinstance(relation, six.string_types):
        try:
            (app_label, model_name) = relation.split('.')
        except ValueError:
            app_label = cls._meta.app_label
            model_name = relation
    else:
        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, relation)
        pending_lookups.setdefault(key, []).append(value)

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/db/models/fields/related.py add_lazy_relation/VarMisuse@163/560 `operation`->`relation`