role field cannot be null when changing ip address via API #1906

Closed
opened 2025-12-29 17:20:16 +01:00 by adam · 1 comment
Owner

Originally created by @orgito on GitHub (Aug 7, 2018).

Environment

  • Python version: 3.4.8
  • NetBox version: 2.4.0

Steps to Reproduce

Change an IP address with the role field as null.

Expected Behavior

Should save the IP address

Observed Behavior

Fails with the errror:

{"role":["This field may not be null."]}

Adding allow_null=True to f59682a7c9/netbox/ipam/api/serializers.py (L261) solves the issue

Originally created by @orgito on GitHub (Aug 7, 2018). <!-- NOTE: This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.4.8 * NetBox version: 2.4.0 <!-- Describe in detail the steps that someone else can take to reproduce this bug using the current stable release of NetBox (or the current beta release where applicable). --> ### Steps to Reproduce Change an IP address with the role field as null. <!-- What did you expect to happen? --> ### Expected Behavior Should save the IP address <!-- What happened instead? --> ### Observed Behavior Fails with the errror: ```python {"role":["This field may not be null."]} ``` Adding `allow_null=True` to https://github.com/digitalocean/netbox/blob/f59682a7c955baa6b336ebe927d69c26f725ad67/netbox/ipam/api/serializers.py#L261 solves the issue
adam added the type: bugstatus: accepted labels 2025-12-29 17:20:16 +01:00
adam closed this issue 2025-12-29 17:20:16 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 7, 2018):

I've found this same issue in several places where ChoiceField is used on a nullable field.

@jeremystretch commented on GitHub (Aug 7, 2018): I've found this same issue in several places where ChoiceField is used on a nullable field.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1906