KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an m2m field called "admins" inside a model and I need to obtain from a view all the selected entries in that field, which are user IDs. Then with the user IDs obtain the emails for every user. Is it possible? The exact thing I want to do is to send a mass email to all the admins of a space inside this platform. Spaces model: class Space(models.Model): """ Spaces model. This model stores a "space" or "place" also known as a participative process in reality. Every place has a minimum set of settings for customization. There are three main permission roles in every space: administrator (admins), moderators (mods) and regular users (users). """ name = models.CharField(_('Name'), max_length=250, unique=True, help_text=_('Max: 250 characters')) url = models.CharField(_('URL'), max_length=100, unique=True, validators=[RegexValidator(regex='^[a-z0-9_]+$', message='Invalid characters in the space URL.')], help_text=_('Valid characters are lowercase, digits and \ admins = models.ManyToManyField(User, related_name="space_admins", verbose_name=_('Administrators'), help_text=_('Please select the \ users that will be administrators of this space'), blank=True, null=True) mods = models.ManyToManyField(User, related_name="space_mods", verbose_name=_('Moderators'), help_text=_('Please select the users \ that will be moderators of this space.'), blank=True, null=True) users = models.ManyToManyField(User, related_name="space_users", verbose_name=_('Users'), help_text=_('Please select the users that \ can participate on this space'), blank=True, null=True) View for sending just one email: @login_required def add_intent(request, s
Tags (comma-separated)
Save Edits
Cancel