mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
- Move do_not_call_in_templates to BaseScript
- Fix the name classproperty
This commit is contained in:
@ -259,6 +259,10 @@ class BaseScript:
|
||||
Base model for custom scripts. User classes should inherit from this model if they want to extend Script
|
||||
functionality for use in other subclasses.
|
||||
"""
|
||||
|
||||
# Prevent django from instantiating the class on all accesses
|
||||
do_not_call_in_templates = True
|
||||
|
||||
class Meta:
|
||||
pass
|
||||
|
||||
@ -280,7 +284,7 @@ class BaseScript:
|
||||
|
||||
@classproperty
|
||||
def name(self):
|
||||
return getattr(self.Meta, 'name', self.__class__.__name__)
|
||||
return getattr(self.Meta, 'name', self.__name__)
|
||||
|
||||
@classproperty
|
||||
def full_name(self):
|
||||
|
@ -753,8 +753,6 @@ class ScriptListView(ContentTypePermissionRequiredMixin, View):
|
||||
|
||||
for _scripts in scripts.values():
|
||||
for script in _scripts.values():
|
||||
# Prevent django from instantiating the class on all accesses
|
||||
script.do_not_call_in_templates = True
|
||||
script.result = results.get(script.full_name)
|
||||
|
||||
return render(request, 'extras/script_list.html', {
|
||||
|
Reference in New Issue
Block a user