Skip to content
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

serialized_data not included when m2m field changes #518

Open
alejandro-perez opened this issue Mar 17, 2023 · 7 comments
Open

serialized_data not included when m2m field changes #518

alejandro-perez opened this issue Mar 17, 2023 · 7 comments

Comments

@alejandro-perez
Copy link

I have the following setting:

{"model": "opportunities.meeting", "serialize_data": True, "m2m_fields": ["consultants", "contacts"]},

When a field changes for a Meeting, "serialized_data" is provided. however, when one of t he M2M fields changes, the "serialized_data" field is left empty. I need serialized_data as a means to track changes to related objects. E.g the history of an opportunity includes the history of changes to all its meetings, and I find that by inspecting serialized_data and getting the value of the foreign key.

@alejandro-perez
Copy link
Author

It seems that all is needed is to add

            kwargs.setdefault(
                "serialized_data", self._get_serialized_data_or_none(instance)
            )

to LogEntry.log_m2m_changes()

@alejandro-perez
Copy link
Author

alejandro-perez commented Mar 23, 2023 via email

@alejandro-perez
Copy link
Author

Which branch should I look at to see this fix? I cannot find it on master

@hramezani
Copy link
Member

Sorry. I thought it got fixed.

Could you provide a patch with the fix?

@hramezani hramezani reopened this May 17, 2023
@alejandro-perez
Copy link
Author

It's just the line in #518 (comment). I can create a PR if that's preferrable

@hramezani
Copy link
Member

It would be great if this change will fix the problem.

please remember you need to provide:

@alejandro-perez
Copy link
Author

Ahh, that's why I didn't bother for just a one line change :)
I'll do it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants