Fixes #19851: Fix WirelessLANImportForm has no field scope, improve validation (#20273)

This commit is contained in:
Jason Novinger
2025-09-05 21:59:38 +00:00
committed by GitHub
parent 94faf58c27
commit 026737b62b
2 changed files with 26 additions and 7 deletions

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):