Contact group assignments are not recorded in changelog #11149

Closed
opened 2025-12-29 21:40:59 +01:00 by adam · 1 comment
Owner

Originally created by @jeremystretch on GitHub (May 8, 2025).

Originally assigned to: @jeremystretch on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.3.0

Python Version

3.10

Steps to Reproduce

  1. Create a contact group named Group 1
  2. Create a contact named Contact 1 and assign it to the group
  3. Inspect the creation record for the contact in the changelog

Expected Behavior

The assigned group should appear in a groups list in the serialized representation of the contact.

Observed Behavior

There is no groups field in the changelog data:

{
    'link': '',
    'name': 'Contact 1',
    'tags': [],
    'email': '',
    'phone': '',
    'title': '',
    'address': '',
    'created': '2025-05-08T19:14:40.686Z',
    'comments': '',
    'description': '',
    'custom_fields': {}
}
Originally created by @jeremystretch on GitHub (May 8, 2025). Originally assigned to: @jeremystretch on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.3.0 ### Python Version 3.10 ### Steps to Reproduce 1. Create a contact group named Group 1 2. Create a contact named Contact 1 and assign it to the group 3. Inspect the creation record for the contact in the changelog ### Expected Behavior The assigned group should appear in a `groups` list in the serialized representation of the contact. ### Observed Behavior There is no `groups` field in the changelog data: ``` { 'link': '', 'name': 'Contact 1', 'tags': [], 'email': '', 'phone': '', 'title': '', 'address': '', 'created': '2025-05-08T19:14:40.686Z', 'comments': '', 'description': '', 'custom_fields': {} } ```
adam added the type: bugstatus: acceptedseverity: medium labels 2025-12-29 21:40:59 +01:00
adam closed this issue 2025-12-29 21:40:59 +01:00
Author
Owner

@jeremystretch commented on GitHub (May 8, 2025):

The root cause here is that Django's PythonSerializer doesn't know how to handle many-to-many fields which use a custom through model (see handle_m2m_field()).

@jeremystretch commented on GitHub (May 8, 2025): The root cause here is that Django's [PythonSerializer](https://github.com/django/django/blob/84e91262d6b94d35b381d0a46ff5402eaac7c996/django/core/serializers/python.py#L14) doesn't know how to handle many-to-many fields which use a custom through model (see [`handle_m2m_field()`](https://github.com/django/django/blob/84e91262d6b94d35b381d0a46ff5402eaac7c996/django/core/serializers/python.py#L67)).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11149