X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/0b2532c7cb7ef08953a178f772592fc47685dc9f..eb92dd2c3fb708cdb382af4a016e60f15b3c2be6:/forum/forms.py diff --git a/forum/forms.py b/forum/forms.py index bf14d54..c644b04 100644 --- a/forum/forms.py +++ b/forum/forms.py @@ -2,14 +2,13 @@ import re from datetime import date from django import forms from models import * -from const import * from django.utils.translation import ugettext as _ from django.contrib.humanize.templatetags.humanize import apnumber from forum.models import User from django.utils.safestring import mark_safe from forum.utils.forms import NextUrlField, UserNameField, SetPasswordForm -from django.conf import settings +from forum import settings import logging class TitleField(forms.CharField): @@ -130,9 +129,6 @@ class AnswerForm(forms.Form): self.fields['wiki'].initial = True -class CloseForm(forms.Form): - reason = forms.ChoiceField(choices=CLOSE_REASONS) - class RetagQuestionForm(forms.Form): tags = TagNamesField() # initialize the default values @@ -192,8 +188,6 @@ class EditAnswerForm(forms.Form): class EditUserForm(forms.Form): email = forms.EmailField(label=u'Email', help_text=_('this email does not have to be linked to gravatar'), required=True, max_length=255, widget=forms.TextInput(attrs={'size' : 35})) - if settings.EDITABLE_SCREEN_NAME: - username = UserNameField(label=_('Screen name')) realname = forms.CharField(label=_('Real name'), required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35})) website = forms.URLField(label=_('Website'), required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35})) city = forms.CharField(label=_('Location'), required=False, max_length=255, widget=forms.TextInput(attrs={'size' : 35})) @@ -202,8 +196,8 @@ class EditUserForm(forms.Form): def __init__(self, user, *args, **kwargs): super(EditUserForm, self).__init__(*args, **kwargs) - logging.debug('initializing the form') if settings.EDITABLE_SCREEN_NAME: + self.fields['username'] = UserNameField(label=_('Screen name')) self.fields['username'].initial = user.username self.fields['username'].user_instance = user self.fields['email'].initial = user.email @@ -233,6 +227,12 @@ class EditUserForm(forms.Form): raise forms.ValidationError(_('this email has already been registered, please use another one')) return self.cleaned_data['email'] +NOTIFICATION_CHOICES = ( + ('i', _('Instantly')), + ('d', _('Daily')), + ('w', _('Weekly')), + ('n', _('No notifications')), +) class SubscriptionSettingsForm(forms.Form): member_joins = forms.ChoiceField(widget=forms.RadioSelect, choices=NOTIFICATION_CHOICES)