mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 02:48:38 -06:00
Ensure deterministic ordering of attriubte fields
This commit is contained in:
parent
c1ff89e98f
commit
0d2a8b8b85
@ -489,15 +489,16 @@ class ModuleTypeForm(NetBoxModelForm):
|
|||||||
prop = JSONSchemaProperty(**options)
|
prop = JSONSchemaProperty(**options)
|
||||||
attr_fields[name] = prop.to_form_field(name, required=name in required_fields)
|
attr_fields[name] = prop.to_form_field(name, required=name in required_fields)
|
||||||
|
|
||||||
return attr_fields
|
return dict(sorted(attr_fields.items()))
|
||||||
|
|
||||||
def _post_clean(self):
|
def _post_clean(self):
|
||||||
|
|
||||||
# Compile attribute data from the individual form fields
|
# Compile attribute data from the individual form fields
|
||||||
self.instance.attribute_data = {
|
if self.cleaned_data.get('profile'):
|
||||||
name[5:]: self.cleaned_data[name] # Remove the attr_ prefix
|
self.instance.attribute_data = {
|
||||||
for name in self.attr_fields if self.cleaned_data[name] is not None
|
name[5:]: self.cleaned_data[name] # Remove the attr_ prefix
|
||||||
}
|
for name in self.attr_fields if self.cleaned_data[name] is not None
|
||||||
|
}
|
||||||
|
|
||||||
return super()._post_clean()
|
return super()._post_clean()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user