{"action":"created","issue":{"url":"https://api.github.com/repos/digitalocean/netbox/issues/2358","repository_url":"https://api.github.com/repos/digitalocean/netbox","labels_url":"https://api.github.com/repos/digitalocean/netbox/issues/2358/labels{/name}","comments_url":"https://api.github.com/repos/digitalocean/netbox/issues/2358/comments","events_url":"https://api.github.com/repos/digitalocean/netbox/issues/2358/events","html_url":"https://github.com/digitalocean/netbox/issues/2358","id":350605365,"node_id":"MDU6SXNzdWUzNTA2MDUzNjU=","number":2358,"title":"Different default value for 'custom_field' if created via WebUI vs RestAPI ","user":{"login":"bdlamprecht","id":7783306,"node_id":"MDQ6VXNlcjc3ODMzMDY=","avatar_url":"https://avatars3.githubusercontent.com/u/7783306?v=4","gravatar_id":"","url":"https://api.github.com/users/bdlamprecht","html_url":"https://github.com/bdlamprecht","followers_url":"https://api.github.com/users/bdlamprecht/followers","following_url":"https://api.github.com/users/bdlamprecht/following{/other_user}","gists_url":"https://api.github.com/users/bdlamprecht/gists{/gist_id}","starred_url":"https://api.github.com/users/bdlamprecht/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdlamprecht/subscriptions","organizations_url":"https://api.github.com/users/bdlamprecht/orgs","repos_url":"https://api.github.com/users/bdlamprecht/repos","events_url":"https://api.github.com/users/bdlamprecht/events{/privacy}","received_events_url":"https://api.github.com/users/bdlamprecht/received_events","type":"User","site_admin":false},"labels":[{"id":817501893,"node_id":"MDU6TGFiZWw4MTc1MDE4OTM=","url":"https://api.github.com/repos/digitalocean/netbox/labels/status:%20gathering%20feedback","name":"status: gathering feedback","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-08-14T21:31:09Z","updated_at":"2018-08-22T18:02:27Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"### Environment\r\n* Python version:  3.6\r\n* NetBox version:  2.4.3\r\n\r\nThis was a feature request in #2159.\r\n\r\nI don't recall if it _used_ to work the same way consistently, but I just verified that the result is different if the operation is performed via the WebUI vs the API.\r\n\r\n### Steps to Reproduce\r\n1. Create a new `custom_field` and set it up against an `Object` (I chose to apply this to `dcim > site`).\r\n2. Choose type `Selection` and setup the `Custom Field Choices` appropriately.\r\n3. Then add a value for the \"default\" that matches **exactly** to one of the previously defined `Choices`.\r\n4. Create a new `Object` via the WebUI, and it works as expected.\r\n5. Attempt the same type of creation via the API, and the default gets left alone.\r\n\r\n### Expected Behavior\r\nHave both the WebUI and API operate the same way.\r\n\r\n### Observed Behavior\r\nThe `default` value is correctly applied **ONLY** if done in the WebUI."},"comment":{"url":"https://api.github.com/repos/digitalocean/netbox/issues/comments/415124394","html_url":"https://github.com/digitalocean/netbox/issues/2358#issuecomment-415124394","issue_url":"https://api.github.com/repos/digitalocean/netbox/issues/2358","id":415124394,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTEyNDM5NA==","user":{"login":"cimnine","id":804532,"node_id":"MDQ6VXNlcjgwNDUzMg==","avatar_url":"https://avatars0.githubusercontent.com/u/804532?v=4","gravatar_id":"","url":"https://api.github.com/users/cimnine","html_url":"https://github.com/cimnine","followers_url":"https://api.github.com/users/cimnine/followers","following_url":"https://api.github.com/users/cimnine/following{/other_user}","gists_url":"https://api.github.com/users/cimnine/gists{/gist_id}","starred_url":"https://api.github.com/users/cimnine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cimnine/subscriptions","organizations_url":"https://api.github.com/users/cimnine/orgs","repos_url":"https://api.github.com/users/cimnine/repos","events_url":"https://api.github.com/users/cimnine/events{/privacy}","received_events_url":"https://api.github.com/users/cimnine/received_events","type":"User","site_admin":false},"created_at":"2018-08-22T18:02:27Z","updated_at":"2018-08-22T18:02:27Z","author_association":"NONE","body":"I see another reason to implement this:\r\n\r\nWhen creating an object via API, how does the client know, what the default value is? It simply doesn't and must have this knowledge from somewhere else.\r\n\r\nNow if the default value changes in Netbox, the client must be updated as well because he would otherwise create objects with the previous default value, as he has no way to receive the new default value.\r\n\r\nIf the client does not want the default value to be filled in by Netbox, he could still pass `\"cf_field_name\": null`."}}
{"actor":{"display_login":"cimnine"}}