On Mon, Feb 05 2018, Simon Hanna wrote:
from django.contrib.auth.models import User user = User.objects.get(email='address@of.user') print(user.first_name) print(user.last_name)
So, I'll try to make some loop over a list with email addresses, that I can get on the web interface.
These are names that are saved in Postorius' (django) database and have nothing to do with mailman.
I know, but for my use case, it's just what I want, and it seems to work.
Displaying the names stored in django probably won't happen. Matching the names in django with the members in lists would require lots of code
Really? I don't know Python, but wouldn't it be possible (just as an option) to do something like this:
user = User.objects.get(email = ...) if user is found then print next to email address: user.first_name + user.last_name
If there is no Django account associated to the email address, the columns would just be empty.
I think, that my use case is perhaps not so special: whenever you manage a sports club, you'll need lists like
- members@my-club.com
- board@my-club.com
- team-1@my-club.com
- team-2@my-club.com
- and so on
Whenever there is a new member, the administrator will do the sign up with create_user(...) and subscribe him to the right lists. And the members (or the moderators) should be able to check the subscriber list sometimes.
-- Peter