Skip to content

Commit

Permalink
can now replace templates with custom templates
Browse files Browse the repository at this point in the history
  • Loading branch information
dgreisen committed Dec 2, 2010
1 parent d89ce73 commit 2f82b98
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions emailconfirmation/base.py
Expand Up @@ -73,12 +73,10 @@ def send_confirmation(self, email_address):
for field in fields:
context[field] = getattr(email_address, field)

subject = render_to_string(
"emailconfirmation/email_confirmation_subject.txt", context)
subject = render_to_string(self.model._subject_template, context)
# remove superfluous line breaks
subject = "".join(subject.splitlines())
message = render_to_string(
"emailconfirmation/email_confirmation_message.txt", context)
message = render_to_string(self.model._message_template, context)
send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [email_address.email])
return self.create(
email_address=email_address,
Expand All @@ -97,6 +95,8 @@ class EmailConfirmationBase(models.Model):

objects = EmailConfirmationManager()

_message_template = "emailconfirmation/email_confirmation_message.txt"
_subject_template = "emailconfirmation/email_confirmation_subject.txt"
def key_expired(self):
expiration_date = self.sent + timedelta(
days=settings.CONFIRMATION_EXPIRE_AFTER_DAYS)
Expand Down

0 comments on commit 2f82b98

Please sign in to comment.