m2m_changed signal | Overriding on multiple m2m fields | DRF

20 views
Skip to first unread message

Vibhu Agarwal

unread,
Nov 17, 2020, 11:25:55 AM11/17/20
to Django users

Here is the task I'm trying to do:
m2m_changed.png
Full Code: test_django_project/m2m_change_triggers/models.py

Here's the issue: 2nd test in test_django_project/m2m_change_triggers/tests.py fails while the 1st one passes!

So I did some digging and found that this is happening because of `ModelSerializer` `save()` which is performing `field.set(value)` here: rest_framework/serializers.py#L988-L990

- So how would I solve this issue (so that both the tests pass)?
- Is going with signals the best approach? If not, what are the alternatives?
Reply all
Reply to author
Forward
0 new messages