Exemple #1
0
 def process_invite(self, email):
     invitation, created = Invitation.objects.get_or_create(
             organization=self.object, email=email)
     message = InviteToOrganization()
     msg_context = {
         'lang': self.request.user.profile.lang,
         'user': self.object.creator,
         'organization': self.object,
         'link': self.request.build_absolute_uri(
             reverse('organizations:accept',
                     kwargs={'key': invitation.key}))
     }
     if created:
         message.send(email, msg_context)
Exemple #2
0
 def process_invite(self, email):
     invitation, created = Invitation.objects.get_or_create(
         organization=self.object, email=email)
     message = InviteToOrganization()
     msg_context = {
         'lang':
         self.request.user.profile.lang,
         'user':
         self.object.creator,
         'organization':
         self.object,
         'link':
         self.request.build_absolute_uri(
             reverse('organizations:accept', kwargs={'key':
                                                     invitation.key}))
     }
     if created:
         message.send(email, msg_context)
Exemple #3
0
 def form_valid(self, form):
     for email in form.cleaned_data['emails']:
         invitation, created = Invitation.objects.get_or_create(
             organization=self.object, email=email)
         message = InviteToOrganization()
         msg_context = {
             'lang': self.request.user.profile.lang,
             'user': self.object.creator,
             'organization': self.object,
             'link': self.request.build_absolute_uri(
                 reverse('organizations:accept',
                         kwargs={'key': invitation.key}))
         }
         if created:
             message.send(email, msg_context)
     messages.add_message(self.request, messages.SUCCESS,
                          _(u"All messages sent"))
     return super(InviteUsers, self).form_valid(form)
 def form_valid(self, form):
     for user in form.users:
         invitation, created = Invitation.objects.get_or_create(
             organization=self.object,
             user=user)
         message = InviteToOrganization()
         msg_context = {
             'lang': user.profile.lang,
             'user': self.object.creator,
             'organization': self.object,
             'link': self.request.build_absolute_uri(
                 reverse('organizations:accept',
                         kwargs={'key': invitation.key}))
         }
         if created:
             message.send(user.email, msg_context)
     messages.add_message(self.request, messages.SUCCESS,
                          _(u"All messages sent"))
     return super(InviteUsers, self).form_valid(form)