false positive related object in custom fields #9398

Closed
opened 2025-12-29 20:49:18 +01:00 by adam · 5 comments
Owner

Originally created by @opericgithub on GitHub (Mar 27, 2024).

Originally assigned to: @jeremystretch on GitHub.

Deployment Type

Self-hosted

NetBox Version

v3.7.4

Python Version

3.10

Steps to Reproduce

  1. Create new custom field.
  2. Try to delete the newly created custom field.
  3. There is a message that the related object "CustomField_content_types object (n)" will also get deleted.

Expected Behavior

Newly created custom field isn't bound to any object, so user should get simple delete confirmation dialog without related objects.

Observed Behavior

User gets delete confirmation dialog with related objects even though those kinds of objects don't exist.

Another observation, don't know if it is this issue related:
During the upgrade procedure to the feature branch, I get the following error mentioning the customfield_content_types:

File "/opt/netbox/venv/lib/python3.10/site-packages/psycopg/cursor.py", line 732, in execute
    raise ex.with_traceback(None)
django.db.utils.ProgrammingError: relation "extras_customfield_content_types_id_seq" does not exist

Originally created by @opericgithub on GitHub (Mar 27, 2024). Originally assigned to: @jeremystretch on GitHub. ### Deployment Type Self-hosted ### NetBox Version v3.7.4 ### Python Version 3.10 ### Steps to Reproduce 1. Create new custom field. 2. Try to delete the newly created custom field. 3. There is a message that the related object "CustomField_content_types object (n)" will also get deleted. ### Expected Behavior Newly created custom field isn't bound to any object, so user should get simple delete confirmation dialog without related objects. ### Observed Behavior User gets delete confirmation dialog with related objects even though those kinds of objects don't exist. Another observation, don't know if it is this issue related: During the upgrade procedure to the feature branch, I get the following error mentioning the customfield_content_types: ``` File "/opt/netbox/venv/lib/python3.10/site-packages/psycopg/cursor.py", line 732, in execute raise ex.with_traceback(None) django.db.utils.ProgrammingError: relation "extras_customfield_content_types_id_seq" does not exist ```
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 20:49:18 +01:00
adam closed this issue 2025-12-29 20:49:19 +01:00
Author
Owner

@DanSheps commented on GitHub (Mar 28, 2024):

User gets delete confirmation dialog with related objects even though those kinds of objects don't exist.

This is not that it is bound to a specific object, it is just stating that the custom field has a relation to the django content type table.

Technically, it is not incorrect, but I agree we should probably exempt the contenttype field from the relationship check on deletion, at least for this specific case.

@DanSheps commented on GitHub (Mar 28, 2024): > User gets delete confirmation dialog with related objects even though those kinds of objects don't exist. This is not that it is bound to a specific object, it is just stating that the custom field has a relation to the django content type table. Technically, it is not incorrect, but I agree we should probably exempt the contenttype field from the relationship check on deletion, at least for this specific case.
Author
Owner

@opericgithub commented on GitHub (Mar 30, 2024):

Thanks for clarification Dan.

Did you check, whether it has something to do with the failure of the upgrade to the feature branch?

@opericgithub commented on GitHub (Mar 30, 2024): Thanks for clarification Dan. Did you check, whether it has something to do with the failure of the upgrade to the feature branch?
Author
Owner

@DanSheps commented on GitHub (Apr 3, 2024):

Did you check, whether it has something to do with the failure of the upgrade to the feature branch?

This would have nothing to do with it.

Please try a fresh upgrade and let us know if this fails still by opening a new bug.

@DanSheps commented on GitHub (Apr 3, 2024): > Did you check, whether it has something to do with the failure of the upgrade to the feature branch? This would have nothing to do with it. Please try a fresh upgrade and let us know if this fails still by opening a new bug.
Author
Owner

@opericgithub commented on GitHub (Apr 3, 2024):

Thank you Dan. I just tried the upgrade from 3.7.4 as well from 3.6.9 to new v4.0-beta1 and got the same error, so it seems it has nothing to do with it.
I will open a new bug issue.

@opericgithub commented on GitHub (Apr 3, 2024): Thank you Dan. I just tried the upgrade from 3.7.4 as well from 3.6.9 to new v4.0-beta1 and got the same error, so it seems it has nothing to do with it. I will open a new bug issue.
Author
Owner

@Julio-Oliveira-Encora commented on GitHub (Apr 10, 2024):

Could you please assign it to me?

@Julio-Oliveira-Encora commented on GitHub (Apr 10, 2024): Could you please assign it to me?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9398