Skip to content

Conversation

nedagilanian
Copy link

✅ Summary

This PR addresses Issue #324, which involves the lack of logging for Many-to-Many (M2M) field changes in the django-easy-audit package. Specifically, it ensures that events related to M2M add, remove, and clear actions are properly logged, enabling full auditing capabilities for M2M fields.

🔧 What was done?

  • Test Coverage:

    • Added tests to verify that M2M relations trigger the correct audit logs when fields are added, removed, or cleared.
    • The test cases now cover all M2M change scenarios for accurate auditing.
  • Details of Changes:

    • M2M_ADD: Logs when tags are added to an article (Many-to-Many Add).
    • M2M_REMOVE: Logs when tags are removed from an article (Many-to-Many Remove).
    • M2M_CLEAR: Logs when all tags are cleared from an article (Many-to-Many Clear).

🔍 Why is this needed?
Previously, changes to Many-to-Many fields were not being captured correctly by the audit logging system, leading to incomplete event tracking. This PR ensures full auditing coverage for M2M field changes.

🛠️ Testing:

  • Added comprehensive tests for M2M add, remove, and clear events.
  • Verified that these events are properly logged with the correct event type (e.g., M2M_ADD, M2M_REMOVE, M2M_CLEAR).

🔗 Related Issue
Fixes #324


Tested with Django 5.2 and Python 3.12.

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

Successfully merging this pull request may close these issues.

for manytomany field audit is not working
1 participant