Tuesday, November 17, 2020

m2m_changed signal | Overriding on multiple m2m fields | DRF


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?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b04030bf-4cae-4ced-9b0c-1a232f7b34e9n%40googlegroups.com.

No comments:

Post a Comment