mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-26 18:38: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)
|
||||
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):
|
||||
|
||||
# Compile attribute data from the individual form fields
|
||||
self.instance.attribute_data = {
|
||||
name[5:]: self.cleaned_data[name] # Remove the attr_ prefix
|
||||
for name in self.attr_fields if self.cleaned_data[name] is not None
|
||||
}
|
||||
if self.cleaned_data.get('profile'):
|
||||
self.instance.attribute_data = {
|
||||
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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user