예제 #1
0
 def send(self, **kwargs):
     protocol = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http")
     current_site = kwargs["site"] if "site" in kwargs else Site.objects.get_current()
     signup_url = u"%s://%s%s?%s" % (
         protocol,
         unicode(current_site.domain),
         reverse("account_signup"),
         urllib.urlencode({"code": self.code})
     )
     ctx = {
         "signup_code": self,
         "current_site": current_site,
         "signup_url": signup_url,
     }
     ext = "html" if settings.EMAIL_CONTENT_HTML else "txt"
     subject = render_to_string(
         "account/email/invite_user_subject.{0}".format(ext), ctx)
     message = render_to_string(
         "account/email/invite_user.{0}".format(ext), ctx)
     msg = EmailMessage(subject, message, settings.DEFAULT_FROM_EMAIL, [self.email])
     if settings.EMAIL_CONTENT_HTML:
         msg.content_subtype = "html"
     msg.send()
     self.sent = timezone.now()
     self.save()
     signup_code_sent.send(sender=SignupCode, signup_code=self)
예제 #2
0
 def send(self, **kwargs):
     protocol = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http")
     current_site = kwargs["site"] if "site" in kwargs else Site.objects.get_current()
     signup_url = "{0}://{1}{2}?{3}".format(
         protocol, current_site.domain, reverse("account_signup"), urlencode({"code": self.code})
     )
     ctx = {"signup_code": self, "current_site": current_site, "signup_url": signup_url}
     hookset.send_invitation_email([self.email], ctx)
     self.sent = timezone.now()
     self.save()
     signup_code_sent.send(sender=SignupCode, signup_code=self)
예제 #3
0
 def send(self, **kwargs):
     protocol = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http")
     current_site = kwargs[
         "site"] if "site" in kwargs else Site.objects.get_current()
     signup_url = "{0}://{1}{2}?{3}".format(protocol, current_site.domain,
                                            reverse("account_signup"),
                                            urlencode({"code": self.code}))
     ctx = {
         "signup_code": self,
         "current_site": current_site,
         "signup_url": signup_url,
     }
     hookset.send_invitation_email([self.email], ctx)
     self.sent = timezone.now()
     self.save()
     signup_code_sent.send(sender=SignupCode, signup_code=self)
예제 #4
0
 def send(self, **kwargs):
     protocol = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http")
     current_site = kwargs["site"] if "site" in kwargs else Site.objects.get_current()
     signup_url = u"%s://%s%s?%s" % (
         protocol,
         unicode(current_site.domain),
         reverse("account_signup"),
         urllib.urlencode({"code": self.code}),
     )
     ctx = {"signup_code": self, "current_site": current_site, "signup_url": signup_url}
     subject = render_to_string("account/email/invite_user_subject.txt", ctx)
     message = render_to_string("account/email/invite_user.txt", ctx)
     send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [self.email])
     self.sent = timezone.now()
     self.save()
     signup_code_sent.send(sender=SignupCode, signup_code=self)
예제 #5
0
 def send(self, **kwargs):
     protocol = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http")
     current_site = kwargs[
         "site"] if "site" in kwargs else Site.objects.get_current()
     signup_url = u"%s://%s%s?%s" % (protocol, unicode(
         current_site.domain), reverse("account_signup"),
                                     urllib.urlencode({"code": self.code}))
     ctx = {
         "signup_code": self,
         "current_site": current_site,
         "signup_url": signup_url,
     }
     subject = render_to_string("account/email/invite_user_subject.txt",
                                ctx)
     message = render_to_string("account/email/invite_user.txt", ctx)
     send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [self.email])
     self.sent = timezone.now()
     self.save()
     signup_code_sent.send(sender=SignupCode, signup_code=self)
예제 #6
0
 def send(self, **kwargs):
     protocol = getattr(settings, "DEFAULT_HTTP_PROTOCOL", "http")
     current_site = kwargs.get("site")
     if "signup_url" not in kwargs:
         signup_url = "{0}://{1}{2}?{3}".format(
             protocol,
             current_site.domain,
             reverse("account_signup"),
             urlencode({"code": self.code})
         )
     else:
         signup_url = kwargs["signup_url"]
     ctx = {
         "signup_code": self,
         "current_site": current_site,
         "signup_url": signup_url,
     }
     ctx.update(kwargs.get("extra_ctx", {}))
     hookset.send_invitation_email([self.email], ctx)
     self.sent = timezone.now()
     self.save()
     signup_code_sent.send(sender=SignupCode, signup_code=self)