Improve unique constraint check error message for custom rendition models

Co-authored-by: Cynthia Kiser <cnk@caltech.edu>
pull/8716/head
Sage Abdullah 2025-02-06 11:35:50 +00:00
rodzic ea30d636d4
commit 1aecddf34a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: EB1A33CC51CC0217
1 zmienionych plików z 9 dodań i 4 usunięć

Wyświetl plik

@ -1409,10 +1409,15 @@ class AbstractRendition(ImageFileMixin, models.Model):
if not in_unique_together and not in_unique_constraint:
errors.append(
checks.Error(
"Custom rendition model %r has an invalid unique_together setting"
% cls,
hint="Custom rendition models must include the constraint "
"('image', 'filter_spec', 'focal_point_key') in their unique_together definition, or as part of a unique constraint.",
"Custom rendition model '%s' must include a unique constraint "
"on the 'image', 'filter_spec', and 'focal_point_key' fields."
% cls._meta.label,
hint=(
"Add models.UniqueConstraint(fields={"
'"image", "filter_spec", "focal_point_key"}, '
'name="unique_rendition") to %s.Meta.constraints.'
% (cls.__name__,)
),
obj=cls,
id="wagtailimages.E001",
)