Make CachedScopeMixin.clean() raise non-field ValidationError

This commit is contained in:
Jason Novinger 2025-09-05 07:27:20 -05:00
parent 545773e221
commit c785b0409b

View File

@ -87,11 +87,9 @@ class CachedScopeMixin(models.Model):
def clean(self):
if self.scope_type and not (self.scope or self.scope_id):
scope_type = self.scope_type.model_class()
raise ValidationError({
'scope': _(
"Please select a {scope_type}."
).format(scope_type=scope_type._meta.model_name)
})
raise ValidationError(
_("Please select a {scope_type}.").format(scope_type=scope_type._meta.model_name)
)
super().clean()
def save(self, *args, **kwargs):