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): def clean(self):
if self.scope_type and not (self.scope or self.scope_id): if self.scope_type and not (self.scope or self.scope_id):
scope_type = self.scope_type.model_class() scope_type = self.scope_type.model_class()
raise ValidationError({ raise ValidationError(
'scope': _( _("Please select a {scope_type}.").format(scope_type=scope_type._meta.model_name)
"Please select a {scope_type}." )
).format(scope_type=scope_type._meta.model_name)
})
super().clean() super().clean()
def save(self, *args, **kwargs): def save(self, *args, **kwargs):