]> git.openstreetmap.org Git - osqa.git/commitdiff
Making the default email subscription option on the register page configurable from...
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Mon, 3 Jan 2011 19:28:37 +0000 (19:28 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Mon, 3 Jan 2011 19:28:37 +0000 (19:28 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@663 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/forms/auth.py
forum/settings/email.py

index cb88ac252dbf2f3ede6f03ad559713f4a8d9405d..c1a7c0914f6d5d05372f079247222d43ade4feaa 100644 (file)
@@ -1,5 +1,6 @@
 from general import NextUrlField,  UserNameField,  UserEmailField, SetPasswordForm
 from forum.models import Question, User
+from forum.settings import INITIAL_EMAIL_SUBSCRIBE_OPTION
 from django.contrib.contenttypes.models import ContentType
 from django.utils.translation import ugettext as _
 from django.utils.safestring import mark_safe
@@ -42,7 +43,7 @@ class SimpleEmailSubscribeForm(forms.Form):
     )
     subscribe = forms.ChoiceField(widget=forms.widgets.RadioSelect(), \
                                 error_messages={'required':_('please choose one of the options above')},
-                                choices=SIMPLE_SUBSCRIBE_CHOICES)
+                                choices=SIMPLE_SUBSCRIBE_CHOICES, initial=INITIAL_EMAIL_SUBSCRIBE_OPTION)
 
 
 class ChangePasswordForm(SetPasswordForm):
index ea96940803bb41e13c9ad71377e9f396ef397402..2a46e294bb101132de37f8a6034803603911dc30 100644 (file)
@@ -1,9 +1,22 @@
 from base import Setting, SettingSet\r
 from django.utils.translation import ugettext_lazy as _\r
 from django.forms.widgets import PasswordInput\r
+from django.forms.widgets import RadioSelect\r
 \r
 EMAIL_SET = SettingSet('email', _('Email settings'), _("Email server and other email related settings."), 50)\r
 \r
+EMAIL_SUBSCRIBE_CHOICES = (\r
+    ('y', _('Users are subscribed by default')),\r
+    ('n', _('Users are not subscribed by default')),\r
+)\r
+\r
+INITIAL_EMAIL_SUBSCRIBE_OPTION = Setting('INITIAL_EMAIL_SUBSCRIBE_OPTION', 'y', EMAIL_SET, dict(\r
+label = _("Default email subscription "),\r
+widget=RadioSelect,\r
+choices=EMAIL_SUBSCRIBE_CHOICES,\r
+help_text = _("Choose what should be the default email subscription status while registering."),\r
+required=False))\r
+\r
 EMAIL_HOST = Setting('EMAIL_HOST', '', EMAIL_SET, dict(\r
 label = _("Email Server"),\r
 help_text = _("The SMTP server through which your application will be sending emails."),\r