[Answered ]-In django, how do I return the other end of a many to many join?

1👍

You can .filter(…) [Django-doc] with:

User.objects.filter(other_user_entries__your_user=myuser)

This will return the Users for which there is an Entry_B object where your_user is the given myuser object.


Note: It is normally better to make use of the settings.AUTH_USER_MODEL [Django-doc] to refer to the user model, than to use the User model [Django-doc] directly. For more information you can see the referencing the User model section of the documentation.

Leave a comment