diff options
Diffstat (limited to 'ishtar/furnitures/forms.py')
-rw-r--r-- | ishtar/furnitures/forms.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/ishtar/furnitures/forms.py b/ishtar/furnitures/forms.py index d73f3e849..41fd58edd 100644 --- a/ishtar/furnitures/forms.py +++ b/ishtar/furnitures/forms.py @@ -30,13 +30,14 @@ from django.utils import formats from django.utils.functional import lazy from django.utils.translation import ugettext_lazy as _ from django.shortcuts import render_to_response -from django.template import Context, RequestContext +from django.template import Context, RequestContext, loader from django.db.models import Max from django import forms from django.core.mail import send_mail from django.forms.formsets import formset_factory, BaseFormSet, \ DELETION_FIELD_NAME from django.contrib.auth.models import User +from django.contrib.sites.models import Site from formwizard.forms import NamedUrlSessionFormWizard @@ -512,13 +513,19 @@ class AccountWizard(Wizard): if 'send_password' in dct and dct['send_password'] and \ settings.ADMINS: - app_name = settings.APP_NAME and (" - " + settings.APP_NAME) or "" - subject = u"[Ishtar%(app_name)s] Account creation/modification" % { + site = Site.objects.get_current() + + app_name = site and ("Ishtar - " + site.name) \ + or "Ishtar" + context = Context({'login':dct['username'], + 'password':dct['password'], + 'app_name':app_name, + 'site': site and site.domain or "" + }) + t = loader.get_template('account_activation_email.txt') + msg = t.render(context) + subject = u"[%(app_name)s] Account creation/modification" % { "app_name":app_name} - msg = _(u"You can now log into Ishtar.\n\n" - u" * Login: %(login)s\n" - u" * Password: %(password)s" % {'login':dct['username'], - 'password':dct['password']}) send_mail(subject, msg, settings.ADMINS[0][1], [dct['email']], fail_silently=True) res = render_to_response('wizard_done.html', {}, |