def validate_inline(cls, parent, parent_model):

    # model is already verified to exist and be a Model
    if cls.fk_name: # default value is None
        f = get_field(cls, cls.model, cls.model._meta, 'fk_name', cls.fk_name)
        if not isinstance(f, models.ForeignKey):
            raise ImproperlyConfigured("'%s.fk_name is not an instance of "
                    "models.ForeignKey." % cls.__name__)

    fk = _get_foreign_key(parent_model, cls.model, fk_name=cls.fk_name, can_fail=True)

    # extra = 3
    if not isinstance(getattr(cls, 'extra'), int):
        raise ImproperlyConfigured("'%s.extra' should be a integer."
                % cls.__name__)

    # max_num = None
    max_num = getattr(cls, 'max_num', None)
    if max_num is not None and not isinstance(max_num, int):
        raise ImproperlyConfigured("'%s.max_num' should be an integer or None (default)."
                % cls.__name__)

    # formset
    if hasattr(cls, 'formset') and not issubclass(cls.formset, BaseModelFormSet):
        raise ImproperlyConfigured("'%s.formset' does not inherit from "
                "BaseModelFormSet." % cls.__name__)

    # exclude
    if hasattr(cls, 'exclude') and cls.exclude:
        if fk and cls.exclude in fk.name:
            raise ImproperlyConfigured("%s cannot exclude the field "
                    "'%s' - this is the foreign key to the parent model "
                    "%s." % (cls.__name__, fk.name, parent_model.__name__))
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.2/django/contrib/admin/validation.py/validate_inline/swapped operands of `in`