M2m_changed instance when in reverse
I have the following signal:
@receiver(m2m_changed, sender=User.cars.through)
def car_added_to_user(sender, instance, action, **kwargs):
if action in ("post_add",):
cache.delete(f"user-{instance.pk}")
I can trigger it as expected when doing:
User.cars.add(car)
but if I also want to delete the user from the cache in this case, what do I do?
Car.user_set.add(user)
as in this case the instance is a Car object and not a User object.