comparison gpp/accounts/forms.py @ 2:f3ad863505bf

Got rid of the core.SiteConfig model and all usage.
author Brian Neal <bgneal@gmail.com>
date Sat, 11 Apr 2009 17:57:22 +0000
parents dbd703f7d63a
children b6263ac72052
comparison
equal deleted inserted replaced
1:dbd703f7d63a 2:f3ad863505bf
4 from django.contrib.auth.models import User 4 from django.contrib.auth.models import User
5 from django.core.urlresolvers import reverse 5 from django.core.urlresolvers import reverse
6 from django.template.loader import render_to_string 6 from django.template.loader import render_to_string
7 from django.contrib.sites.models import Site 7 from django.contrib.sites.models import Site
8 8
9 from core.models import SiteConfig 9 import settings
10 from core.functions import send_mail 10 from core.functions import send_mail
11 from accounts.models import PendingUser 11 from accounts.models import PendingUser
12 from accounts.models import IllegalUsername 12 from accounts.models import IllegalUsername
13 from accounts.models import IllegalEmail 13 from accounts.models import IllegalEmail
14 14
70 self.cleaned_data['password1']) 70 self.cleaned_data['password1'])
71 71
72 # Send the confirmation email 72 # Send the confirmation email
73 73
74 site = Site.objects.get_current() 74 site = Site.objects.get_current()
75 site_config = SiteConfig.objects.get_current() 75 admin_email = settings.ADMINS[0][1]
76 76
77 activation_link = 'http://%s%s' % (site.domain, reverse('accounts.views.register_confirm', 77 activation_link = 'http://%s%s' % (site.domain, reverse('accounts.views.register_confirm',
78 kwargs = {'username' : pending_user.username, 'key' : pending_user.key})) 78 kwargs = {'username' : pending_user.username, 'key' : pending_user.key}))
79 79
80 msg = render_to_string('accounts/registration_email.txt', 80 msg = render_to_string('accounts/registration_email.txt',
83 'site_domain' : site.domain, 83 'site_domain' : site.domain,
84 'user_email' : pending_user.email, 84 'user_email' : pending_user.email,
85 'activation_link' : activation_link, 85 'activation_link' : activation_link,
86 'username' : pending_user.username, 86 'username' : pending_user.username,
87 'raw_password' : self.cleaned_data['password1'], 87 'raw_password' : self.cleaned_data['password1'],
88 'admin_email' : site_config.admin_email, 88 'admin_email' : admin_email,
89 }) 89 })
90 90
91 subject = 'Registration Confirmation for ' + site.name 91 subject = 'Registration Confirmation for ' + site.name
92 send_mail(subject, msg, site_config.admin_email, [self.cleaned_data['email']]) 92 send_mail(subject, msg, admin_email, [self.cleaned_data['email']])
93 93
94 return pending_user 94 return pending_user
95 95