I am writing a Django app which define groups of user. A user can be part of many groups.
I want to be able to retrieve, from a list of groups, users which are members of at least one of those groups and with no duplicate.
So i wrote a query to accomplish that. That method will take a list of group_id and simply returns a list of users. My question is: where is the best place to put that method?
I was thinking to create a custom manager for my Group model. But it don't seems logical as my method will return to me a list of Users.
According to the doc: https://docs.djangoproject.com/en/1.8/topics/db/managers/
Manager of a model should contains queries about that model.
After some research, I've seen that is not advised to extends the django.auth.models.User manager (at least in my case).
For the moment, i will just put my method in a 'service.py' file, but I was wondering if there is not a more elegant way to accomplish what i am trying to do.
Thanks by advance for your suggestions!