mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-29 03:46:25 -06:00
Cleaner logic
This commit is contained in:
parent
bf82101e84
commit
6a4c944e64
@ -87,14 +87,13 @@ class CachedScopeMixin(models.Model):
|
|||||||
abstract = True
|
abstract = True
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if self.scope_type:
|
if self.scope_type and not self.scope:
|
||||||
scope_type = self.scope_type.model_class()
|
scope_type = self.scope_type.model_class()
|
||||||
if not self.scope:
|
raise ValidationError({
|
||||||
raise ValidationError({
|
'scope': _(
|
||||||
'scope': _(
|
"Please select a {scope_type}."
|
||||||
"Please select a {scope_type}."
|
).format(scope_type=scope_type._meta.model_name)
|
||||||
).format(scope_type=scope_type._meta.model_name)
|
})
|
||||||
})
|
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
# Cache objects associated with the terminating object (for filtering)
|
# Cache objects associated with the terminating object (for filtering)
|
||||||
|
Loading…
Reference in New Issue
Block a user