def get_field(model, field_name):
    """Run get_field on the model, but detect _id as a fallback."""
    try:
        return model._meta.get_field(field_name)
    except Exception as e:
        if field_name.endswith('_id'):
            return model._meta.get_field(field_name[:-3])
        else:
            raise e