diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-04-23 12:58:35 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-04-23 12:58:35 -0400 |
commit | 1ca11a43c74af6c895ed330d9b115dcc335d6160 (patch) | |
tree | 1499f0780050739bcb5275fb5bfb09e5ea9ebb3e /forum | |
parent | 3cb6d424e8995a43d0cf5ba1e2d997712ca82d49 (diff) | |
download | askbot-1ca11a43c74af6c895ed330d9b115dcc335d6160.tar.gz askbot-1ca11a43c74af6c895ed330d9b115dcc335d6160.tar.bz2 askbot-1ca11a43c74af6c895ed330d9b115dcc335d6160.zip |
fixed second bug in edit user profile
Diffstat (limited to 'forum')
-rw-r--r-- | forum/context.py | 1 | ||||
-rwxr-xr-x | forum/forms.py | 2 | ||||
-rw-r--r-- | forum/skins/default/templates/user_edit.html | 8 | ||||
-rwxr-xr-x | forum/views/users.py | 5 |
4 files changed, 13 insertions, 3 deletions
diff --git a/forum/context.py b/forum/context.py index d8f1d838..043af81d 100644 --- a/forum/context.py +++ b/forum/context.py @@ -16,6 +16,7 @@ def application_settings(context): 'WIKI_ON':settings.WIKI_ON, 'RESOURCE_REVISION':settings.RESOURCE_REVISION, 'ASKBOT_SKIN':settings.ASKBOT_DEFAULT_SKIN, + 'EDITABLE_SCREEN_NAME':settings.EDITABLE_SCREEN_NAME, } return {'settings':my_settings} diff --git a/forum/forms.py b/forum/forms.py index b205c6e1..4139abb8 100755 --- a/forum/forms.py +++ b/forum/forms.py @@ -289,7 +289,7 @@ 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')) + 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})) diff --git a/forum/skins/default/templates/user_edit.html b/forum/skins/default/templates/user_edit.html index 8109949f..abbce58a 100644 --- a/forum/skins/default/templates/user_edit.html +++ b/forum/skins/default/templates/user_edit.html @@ -38,7 +38,13 @@ </tr>
<tr style="height:35px">
<td>{% trans "Screen Name" %}:</td>
- <td>{{ request.user.username }} <span class="form-error"></span> {{ form.username.errors }} </td>
+ <td>
+ {% if settings.EDITABLE_SCREEN_NAME %}
+ {{ form.username }}
+ {% else %}
+ {{ request.user.username }}
+ {% endif %}
+ <span class="form-error"></span> {{ form.username.errors }} </td>
</tr>
<tr style="height:35px">
diff --git a/forum/views/users.py b/forum/views/users.py index 7f2fcf84..113c46e6 100755 --- a/forum/views/users.py +++ b/forum/views/users.py @@ -18,6 +18,7 @@ import calendar from django.contrib.contenttypes.models import ContentType from forum.models import user_updated from forum.const import USERS_PAGE_SIZE +from django.conf import settings question_type = ContentType.objects.get_for_model(Question) answer_type = ContentType.objects.get_for_model(Answer) @@ -121,7 +122,9 @@ def edit_user(request, id): set_new_email(user, new_email) - #user.username = sanitize_html(form.cleaned_data['username']) + if settings.EDITABLE_SCREEN_NAME: + user.username = sanitize_html(form.cleaned_data['username']) + user.real_name = sanitize_html(form.cleaned_data['realname']) user.website = sanitize_html(form.cleaned_data['website']) user.location = sanitize_html(form.cleaned_data['city']) |