# Path: feincms3/utils.py
# def validation_error(error, *, field, exclude, **kwargs):
#     """
#     Return a validation error that is associated with a particular field if it
#     isn't excluded from validation.
# 
#     See https://github.com/django/django/commit/e8c056c31 for some background.
#     """
#     return ValidationError(
#         error if field in (exclude or ()) else {field: error}, **kwargs
#     )


from collections import OrderedDict
from django.core.checks import Warning
from django.core.validators import MinValueValidator, RegexValidator
from django.db import models
from django.db.models import Max, Q
from django.urls import NoReverseMatch, get_script_prefix, reverse
from django.utils.encoding import iri_to_uri
from django.utils.translation import gettext_lazy as _
from tree_queries.models import TreeNode, TreeQuerySet
from feincms3.utils import validation_error
    def clean_fields(self, exclude=None):
        """
        Check for path uniqueness problems.
        """
        super().clean_fields(exclude)

        if self.static_path:
            if not self.path:
                raise validation_error(
                    _("Static paths cannot be empty. Did you mean '/'?"),
                    field="path",
                    exclude=exclude,
                )
        else:
            self.path = "{}{}/".format(
                self.parent.path if self.parent else "/", self.slug
            )

        super().clean()

        # Skip if we don't exist yet.
        if not self.pk:
            return

        clash_candidates = dict(self._path_clash_candidates().values_list("path", "id"))
        for pk, node in self._branch_for_update().items():
            if (
                node.path in clash_candidates
                and not clash_candidates[node.path] == node.pk
            ):

# Path: feincms3/utils.py
# def validation_error(error, *, field, exclude, **kwargs):
#     """
#     Return a validation error that is associated with a particular field if it
#     isn't excluded from validation.
# 
#     See https://github.com/django/django/commit/e8c056c31 for some background.
#     """
#     return ValidationError(
#         error if field in (exclude or ()) else {field: error}, **kwargs
#     )


# Path: feincms3/pages.py
from collections import OrderedDict
from django.core.checks import Warning
from django.core.validators import MinValueValidator, RegexValidator
from django.db import models
from django.db.models import Max, Q
from django.urls import NoReverseMatch, get_script_prefix, reverse
from django.utils.encoding import iri_to_uri
from django.utils.translation import gettext_lazy as _
from tree_queries.models import TreeNode, TreeQuerySet
from feincms3.utils import validation_error

    def clean_fields(self, exclude=None):
        """
        Check for path uniqueness problems.
        """
        super().clean_fields(exclude)

        if self.static_path:
            if not self.path:
                raise validation_error(
                    _("Static paths cannot be empty. Did you mean '/'?"),
                    field="path",
                    exclude=exclude,
                )
        else:
            self.path = "{}{}/".format(
                self.parent.path if self.parent else "/", self.slug
            )

        super().clean()

        # Skip if we don't exist yet.
        if not self.pk:
            return

        clash_candidates = dict(self._path_clash_candidates().values_list("path", "id"))
        for pk, node in self._branch_for_update().items():
            if (
                node.path in clash_candidates
                and not clash_candidates[node.path] == node.pk
            ):

                raise validation_error(