Replies: 1 comment 2 replies
-
Converted this to a discussion as it is not a bug.
Runs correctly here: device = Device(
name="test2",
device_type=DeviceType.objects.get(id=8),
site=Site.objects.first(),
device_role=DeviceRole.objects.first(),
status=DeviceStatusChoices.STATUS_ACTIVE,
comments="",
)
device.full_clean()
device.save()
Completes without issues here.
It is defined right here: netbox/netbox/netbox/models/__init__.py Lines 62 to 69 in 08a419e Must be something about your netbox instance or maybe you overwrote something in your script. Works as intended in normal installs. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
NetBox version
v3.4.1
Python version
3.10
Steps to Reproduce
Create a script to create devices. In the run() definition add this:
That should fail with a "description" of relation "dcim_device" violates not-null constraint.
Then this version:
Fails with "Device() got an unexpected keyword argument 'description'"
Expected Behavior
We should be able to create a device using the Device() model.
Observed Behavior
This is the error if you don't have a description field:
This is the error if you have a description field:
I think the problem is that "description" isn't defined as a column in netbox/dcim/models/devices.py, but I'm not entirely sure because that was just from a quick look. This could also be something I broke in my custom script or whatever.
Please let me know if you need more information.
Beta Was this translation helpful? Give feedback.
All reactions