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)
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)
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)