From 99394de14ebcdb8243b48851756cb13ce6994040 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 15 Aug 2019 16:19:25 -0400 Subject: [PATCH] Change fields to field_order --- docs/additional-features/custom-scripts.md | 6 +++--- netbox/extras/scripts.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/additional-features/custom-scripts.md b/docs/additional-features/custom-scripts.md index 7c74a9079..bdcd8967d 100644 --- a/docs/additional-features/custom-scripts.md +++ b/docs/additional-features/custom-scripts.md @@ -55,12 +55,12 @@ This is the human-friendly names of your script. If omitted, the class name will A human-friendly description of what your script does. -### `fields` +### `field_order` -The order in which the variable fields should appear. This is optional, however on Python 3.5 and earlier the fields will appear in random order. (Declarative ordering is preserved on Python 3.6 and above.) For example: +A list of field names indicating the order in which the form fields should appear. This is optional, however on Python 3.5 and earlier the fields will appear in random order. (Declarative ordering is preserved on Python 3.6 and above.) For example: ``` -fields = ['var1', 'var2', 'var3'] +field_order = ['var1', 'var2', 'var3'] ``` ## Reading Data from Files diff --git a/netbox/extras/scripts.py b/netbox/extras/scripts.py index 2a0c0db7b..c38a795d5 100644 --- a/netbox/extras/scripts.py +++ b/netbox/extras/scripts.py @@ -178,9 +178,9 @@ class Script: def _get_vars(self): vars = OrderedDict() - # Infer order from Meta.fields (Python 3.5 and lower) - fields = getattr(self.Meta, 'fields', []) - for name in fields: + # Infer order from Meta.field_order (Python 3.5 and lower) + field_order = getattr(self.Meta, 'field_order', []) + for name in field_order: vars[name] = getattr(self, name) # Default to order of declaration on class