def METHOD_NAME(self):
    keys = [self.pk]
    parent = self.parent
    while parent is not None:
        if parent.pk in keys:
            raise ValidationError(
                {
                    NON_FIELD_ERRORS: [
                        _("Circular reference in parent."),
                    ],
                })
        keys.append(parent.pk)
        parent = parent.parent
    return super().METHOD_NAME()