Skip to content

Incorrect field may be reported as changed by m2m_changed() signal handler #207

@JirkaV

Description

@JirkaV

I have a situation where a specific model has multiple M2M relations to django User model. It may be an edge case, but I noticed that easyaudit reports just the first found m2m relation between my model and User model, no matter which of the M2M relations was altered.

After some digging I found out that this is caused by the fact that utils.get_m2m_field_name() which is called by model_signals.py.m2m_changed() returns the first m2m relation between found between the models even if there are multiple. The only place where the actual changed field can be detected from is in the sender argument to m2m_changed() which is currently being ignored.

As my case might be unusual, I'm not expecting a quick fix as this might be non-trivial. However created the issue in case someone else hits the same problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions