Repository: django/django
File: django/db/models/base.py (Python)

Code before:
                            "'%s' refers to a ManyToManyField '%s', but "
                            "ManyToManyFields are not permitted in '%s'."
                            % (
                                option,
                                field_name,
                                option,
                            ),
                            obj=cls,
                            id="models.E013",
                        )
                    )
                elif isinstance(field, models.CompositePrimaryKey):
                    errors.append(
                        checks.Error(
                            f"{option!r} refers to a CompositePrimaryKey "
                            f"{field_name!r}, but CompositePrimaryKeys are not "
                            f"permitted in {option!r}.",
                            obj=cls,
                            id="models.E048",
                        )
                    )
                elif type(field) is models.ForeignObject:
                    errors.append(
                        checks.Error(
                            f"{option!r} refers to a ForeignObject {field_name!r},"
                            f"but ForeignObject are not permitted in {option!r}.",
                            obj=cls,
                            id="models.E049",
                        )
                    )
                elif field not in cls._meta.local_fields:
                    errors.append(
                        checks.Error(
                            "'%s' refers to field '%s' which is not local to model "
                            "'%s'." % (option, field_name, cls._meta.object_name),
                            hint="This issue may be caused by multi-table inheritance.",
                            obj=cls,
                            id="models.E016",
                        )
                    )
        return errors

    @classmethod
    def _check_ordering(cls):
        """
        Check "ordering" option -- is it a list of strings and do all fields
        exist?
        """
        if cls._meta._ordering_clash:
            return [
                checks.Error(

Review comment (suggestion):
```suggestion
                            f"but ForeignObjects are not permitted in {option!r}.",
```

Code after:
                            "'%s' refers to a ManyToManyField '%s', but "
                            "ManyToManyFields are not permitted in '%s'."
                            % (
                                option,
                                field_name,
                                option,
                            ),
                            obj=cls,
                            id="models.E013",
                        )
                    )
                elif isinstance(field, models.CompositePrimaryKey):
                    errors.append(
                        checks.Error(
                            f"{option!r} refers to a CompositePrimaryKey "
                            f"{field_name!r}, but CompositePrimaryKeys are not "
                            f"permitted in {option!r}.",
                            obj=cls,
                            id="models.E048",
                        )
                    )
                elif (
                    isinstance(field.remote_field, ForeignObjectRel)
                    and field not in cls._meta.local_concrete_fields
                    and len(field.from_fields) > 1
                ):
                    errors.append(
                        checks.Error(
                            f"{option!r} refers to a ForeignObject {field_name!r} with "
                            "multiple 'from_fields', which is not supported for that "
                            "option.",
                            obj=cls,
                            id="models.E049",
                        )
                    )
                elif field not in cls._meta.local_fields:
                    errors.append(
                        checks.Error(
                            "'%s' refers to field '%s' which is not local to model "
                            "'%s'." % (option, field_name, cls._meta.object_name),
                            hint="This issue may be caused by multi-table inheritance.",
                            obj=cls,
                            id="models.E016",
                        )
                    )
        return errors

    @classmethod
    def _check_ordering(cls):
        """
        Check "ordering" option -- is it a list of strings and do all fields