def _get_field_by_name(model_class, field_name):
    """
    Compatible with old API of model_class._meta.get_field_by_name(field_name)
    """
    field = model_class._meta.get_field(field_name)
    return (
        field,                                       # field
        field.model,                                 # model
        not field.auto_created or field.concrete,    # direct
        field.many_to_many                           # m2m
    )