Clearing manufacturer & save not possible
Summary
When we edit a device that has a manufacturer entry, we want to clear it & save it, then we get an error from the backend.
Steps to reproduce
- login
- open the page to add a new device
- insert shortname, manufacturer and permission group
- save
- edit this device again
- clear the manufactuerer
- click on save
What is the current bug behavior?
The backend rejects the payload, as the manufacturer_name
field is serialized to a null.
What is the expected correct behavior?
The manfacturer_name should be serialized to an empty string - and the save should succeed.
Some logs and/or screenshots
Payload of the post request
{"data":{"type":"device","attributes":{"description":"","short_name":"manufacturer test","long_name":"","serial_number":"","inventory_number":"","manufacturer_uri":"","manufacturer_name":null,"device_type_uri":"","device_type_name":"","status_uri":"","status_name":"","model":"","persistent_identifier":null,"website":"","dual_use":false,"is_private":false,"is_internal":true,"is_public":false,"group_ids":["1339"]},"id":"20"}}
Possible fixes
- Changed handling in the form to insert the manufacturer (field should not be null at all).
- Changes in the serializer (one could add some handling to replace it
this.manufacturerName || ''
)
Nice to know
It could also affect the platform forms.
ToDo's
-
Bug reproduced -
Cause found -
Bug fixed
Edited by Marc Hanisch