mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 01:48:38 -06:00
Fixes #4043: Fix toggling of required fields in custom scripts
This commit is contained in:
parent
1849473469
commit
e0d538ad31
@ -1,3 +1,11 @@
|
|||||||
|
# v2.7.4 (FUTURE)
|
||||||
|
|
||||||
|
## Bug Fixes
|
||||||
|
|
||||||
|
* [#4043](https://github.com/netbox-community/netbox/issues/4043) - Fix toggling of required fields in custom scripts
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
# v2.7.3 (2020-01-28)
|
# v2.7.3 (2020-01-28)
|
||||||
|
|
||||||
## Enhancements
|
## Enhancements
|
||||||
|
@ -53,14 +53,15 @@ class ScriptVariable:
|
|||||||
# Initialize field attributes
|
# Initialize field attributes
|
||||||
if not hasattr(self, 'field_attrs'):
|
if not hasattr(self, 'field_attrs'):
|
||||||
self.field_attrs = {}
|
self.field_attrs = {}
|
||||||
if description:
|
|
||||||
self.field_attrs['help_text'] = description
|
|
||||||
if label:
|
if label:
|
||||||
self.field_attrs['label'] = label
|
self.field_attrs['label'] = label
|
||||||
|
if description:
|
||||||
|
self.field_attrs['help_text'] = description
|
||||||
if default:
|
if default:
|
||||||
self.field_attrs['initial'] = default
|
self.field_attrs['initial'] = default
|
||||||
if required:
|
self.field_attrs['required'] = required
|
||||||
self.field_attrs['required'] = True
|
|
||||||
|
# Initialize the list of optional validators if none have already been defined
|
||||||
if 'validators' not in self.field_attrs:
|
if 'validators' not in self.field_attrs:
|
||||||
self.field_attrs['validators'] = []
|
self.field_attrs['validators'] = []
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user