Using context variable as html attribute in django template -
i've cloned parts of django-registration project. specifically, registrationprofile
bit activation_key generation, user activation, , verification email sending. i've replaced native send_email bit emailmultialternatives version send html emails. this:
def send_activation_email(self, site): context = { 'link': (site+"signup/activate/"+self.activation_key), 'expiration_days': settings.account_activation_days, 'site': site } # subject subject = render_to_string( 'registration/activation_email_subject.txt', context ) subject = ''.join(subject.splitlines()) # body html_content = render_to_string( 'registration/activation_email.html', context ) text_content = strip_tags(html_content) # message message = emailmultialternatives( subject, text_content, settings.default_from_email, [self.user.email] ) message.attach_alternative(html_content, "text/html")
i can print link {{link}}
in template. how can use link href attribute if wanted <a href={{link}}>activate</a>
(or button)?
Comments
Post a Comment