def filters_for_model(model, fields=None, exclude=None, filter_for_field=None, filter_for_reverse_field=None):
    field_dict = OrderedDict()
    opts = model._meta
    if (fields is None):
        fields = [f.name for f in sorted((opts.fields + opts.many_to_many)) if (not isinstance(f, models.AutoField))]
    for f in fields:
        if ((exclude is not None) and (f in exclude)):
            continue
        field = get_model_field(model, f)
        if (field is None):
            field_dict[f] = None
            continue
        if isinstance(field, ForeignObjectRel):
            filter_ = filter_for_reverse_field(field, f)
            if filter_:
                field_dict[f] = filter_
        elif isinstance(fields, dict):
            for lookup_type in fields[f]:
                filter_ = filter_for_field(field, f, lookup_type)
                if filter_:
                    filter_name = f
                    if (lookup_type != 'exact'):
                        filter_name = ((f + LOOKUP_SEP) + lookup_type)
                    field_dict[filter_name] = filter_
        else:
            filter_ = filter_for_field(field, f)
            if filter_:
                field_dict[f] = filter_
    return field_dict
def filters_for_model(model, fields=None, exclude=None, filter_for_field=None, filter_for_reverse_field=None):
    field_dict = OrderedDict()
    opts = model._meta
    if (fields is None):
        fields = [f.name for f in sorted((opts.fields + opts.many_to_many)) if (not isinstance(f, models.AutoField))]
    for f in fields:
        if ((exclude is not None) and (f in exclude)):
            continue
        field = get_model_field(model, f)
        if (field is None):
            field_dict[f] = None
            continue
        if isinstance(field, ForeignObjectRel):
            filter_ = filter_for_reverse_field(field, f)
            if filter_:
                field_dict[f] = filter_
        elif isinstance(fields, dict):
            for lookup_type in fields[f]:
                filter_ = filter_for_field(field, f, lookup_type)
                if filter_:
                    filter_name = f
                    if (lookup_type != 'exact'):
                        filter_name = ((f + LOOKUP_SEP) + lookup_type)
                    field_dict[filter_name] = filter_
        else:
            filter_ = filter_for_field(field, f)
            if filter_:
                field_dict[f] = filter_
    return field_dict