mirror of
https://github.com/netbox-community/netbox.git
synced 2025-09-06 06:13:36 -06:00
Make CachedScopeMixin.clean() raise non-field ValidationError
This commit is contained in:
parent
545773e221
commit
c785b0409b
@ -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):
|
||||||
|
Loading…
Reference in New Issue
Block a user