-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom fields not created on objects if Django ORM methods are used #3312
Comments
@phoenixswiss Do you have a celery worker running? And if so after you save the object can you run a |
@bryanculver Yes, I have celery worker running. Saving the object and waiting 60 seconds and then refreshing the object from db had the same effect. |
Have you tried this outside a job as well? |
@bryanculver Yes, I tested it outside a job: >>> device = Device.objects.get(name="testdevice")
>>> ip_interface_name = "test"
>>> status_active = Status.objects.get(slug="active")
>>> nautobot_ip_interface = Interface(
... device=device,
... name=ip_interface_name,
... type="virtual",
... status=status_active,
... label=ip_interface_name,
... mgmt_only=False,
... enabled=True,
... mode="access",
... )
>>> nautobot_ip_interface.validated_save()
>>> nautobot_ip_interface.custom_field_data.keys()
dict_keys([])
>>> time.sleep(60)
>>> nautobot_ip_interface.refresh_from_db()
>>> nautobot_ip_interface.custom_field_data.keys()
dict_keys([]) |
Thanks for the extra extra confirmation @phoenixswiss! |
Environment
Steps to Reproduce
null
) as default value and assign it to the object type interface.nautobot_ip_interface.custom_field_data.keys()
or navigate to the Device Change Log site in Nautobot and open theinterface created
entry for the interface, which you have created in step 2. Under Difference note the valueNull
and the new value (JSON) with the propertyObject Data
the custom field sectionyour_custom_field
is missing.Expected Behavior
All custom fields should be created with default values or null on an object if Django ORM methods are used.
Observed Behavior
None custom fields are created.
If you add the custom field data manually before saving, the field will be created:
If pynautobot (REST-API) is used, the custom fields will be created during object creation.
This issue has been discussed here: #3298 (reply in thread)
The text was updated successfully, but these errors were encountered: