diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-08-23 18:06:56 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-08-23 18:06:56 -0400 |
commit | 43745b50d82ca8598791f05668d253aac0c8aa6c (patch) | |
tree | f6c9ddeeef55dd41691ef3f01012376196db29ea | |
parent | a2d1de600828ca6017b65ce36498e824cadca87f (diff) | |
download | askbot-43745b50d82ca8598791f05668d253aac0c8aa6c.tar.gz askbot-43745b50d82ca8598791f05668d253aac0c8aa6c.tar.bz2 askbot-43745b50d82ca8598791f05668d253aac0c8aa6c.zip |
allowed user names > 30 chars
-rw-r--r-- | askbot/__init__.py | 1 | ||||
-rw-r--r-- | askbot/doc/source/changelog.rst | 1 | ||||
-rw-r--r-- | askbot/setup_templates/settings.py | 1 | ||||
-rw-r--r-- | askbot/setup_templates/settings.py.mustache | 1 | ||||
-rw-r--r-- | askbot/skins/default/templates/widgets/user_navigation.html | 2 | ||||
-rw-r--r-- | askbot/startup_procedures.py | 19 | ||||
-rw-r--r-- | askbot/utils/forms.py | 5 | ||||
-rw-r--r-- | askbot_requirements.txt | 1 |
8 files changed, 29 insertions, 2 deletions
diff --git a/askbot/__init__.py b/askbot/__init__.py index 8e4f20ab..59693a5a 100644 --- a/askbot/__init__.py +++ b/askbot/__init__.py @@ -32,6 +32,7 @@ REQUIREMENTS = { 'pystache': 'pystache==0.3.1', 'lamson': 'Lamson', 'pytz': 'pytz', + 'longerusername': 'longerusername', } #necessary for interoperability of django and coffin diff --git a/askbot/doc/source/changelog.rst b/askbot/doc/source/changelog.rst index d88cd734..9d28dd5f 100644 --- a/askbot/doc/source/changelog.rst +++ b/askbot/doc/source/changelog.rst @@ -3,6 +3,7 @@ Changes in Askbot Development version ------------------- +* Allow user names longer than 30 characters (Evgeny) * Option to disable feedback form for the anonymos users (Evgeny) * Optional restriction to have confirmed email address to join forum (Evgeny) * Optional list of allowed email addresses and email domain name for the new users (Evgeny) diff --git a/askbot/setup_templates/settings.py b/askbot/setup_templates/settings.py index 632c4e70..3b1f6bf5 100644 --- a/askbot/setup_templates/settings.py +++ b/askbot/setup_templates/settings.py @@ -150,6 +150,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( INSTALLED_APPS = ( + 'longerusername', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', diff --git a/askbot/setup_templates/settings.py.mustache b/askbot/setup_templates/settings.py.mustache index 18ac214d..69b030ed 100644 --- a/askbot/setup_templates/settings.py.mustache +++ b/askbot/setup_templates/settings.py.mustache @@ -149,6 +149,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( INSTALLED_APPS = ( + 'longerusername', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', diff --git a/askbot/skins/default/templates/widgets/user_navigation.html b/askbot/skins/default/templates/widgets/user_navigation.html index 717cd7ee..227053b0 100644 --- a/askbot/skins/default/templates/widgets/user_navigation.html +++ b/askbot/skins/default/templates/widgets/user_navigation.html @@ -17,7 +17,7 @@ <a href="{{ settings.LOGOUT_URL }}?next={{ settings.LOGOUT_REDIRECT_URL }}">{% trans %}sign out{% endtrans %}</a> {% endif %} {% elif settings.USE_ASKBOT_LOGIN_SYSTEM %} - <a href="{{ settings.LOGIN_URL }}?next={{request.path|clean_login_url}}">{% trans %}Hi, there! Please sign in{% endtrans %}</a> + <a href="{{ settings.LOGIN_URL }}?next={{request.path|clean_login_url}}">{% trans %}Hi there! Please sign in{% endtrans %}</a> {% endif %} {% if request.user.is_authenticated() and request.user.is_administrator() %} <a href="{% url site_settings %}">{% trans %}settings{% endtrans %}</a> diff --git a/askbot/startup_procedures.py b/askbot/startup_procedures.py index 0fec6d5f..4b4575cf 100644 --- a/askbot/startup_procedures.py +++ b/askbot/startup_procedures.py @@ -512,6 +512,24 @@ def test_custom_user_profile_tab(): footer = 'Please carefully read about adding a custom user profile tab.' print_errors(errors, header = header, footer = footer) +def test_longerusername(): + """tests proper installation of the "longerusername" app + """ + errors = list() + if 'longerusername' not in django_settings.INSTALLED_APPS: + errors.append( + "add 'longerusername', as the first item in the INSTALLED_APPS" + ) + else: + index = django_settings.INSTALLED_APPS.index('longerusername') + if index != 0: + message = "move 'longerusername', to the beginning of INSTALLED_APPS" + raise AskbotConfigError(message) + + if errors: + errors.append('run "python manage.py migrate longerusername"') + print_errors(errors) + def run_startup_tests(): """function that runs all startup tests, mainly checking settings config so far @@ -527,6 +545,7 @@ def run_startup_tests(): test_celery() #test_csrf_cookie_domain() test_staticfiles() + test_longerusername() test_avatar() settings_tester = SettingsTester({ 'CACHE_MIDDLEWARE_ANONYMOUS_ONLY': { diff --git a/askbot/utils/forms.py b/askbot/utils/forms.py index 319e9b9d..4375ca17 100644 --- a/askbot/utils/forms.py +++ b/askbot/utils/forms.py @@ -9,6 +9,7 @@ from askbot.conf import settings as askbot_settings from askbot.utils.slug import slugify from askbot.utils.functions import split_list from askbot import const +from longerusername import MAX_USERNAME_LENGTH import logging import urllib @@ -78,7 +79,9 @@ class UserNameField(StrippedNonEmptyCharField): if 'error_messages' in kw: error_messages.update(kw['error_messages']) del kw['error_messages'] - super(UserNameField,self).__init__(max_length=30, + + max_length = MAX_USERNAME_LENGTH + super(UserNameField,self).__init__(max_length=max_length, widget=forms.TextInput(attrs=login_form_widget_attrs), label=label, error_messages=error_messages, diff --git a/askbot_requirements.txt b/askbot_requirements.txt index 7b619c36..885a21e3 100644 --- a/askbot_requirements.txt +++ b/askbot_requirements.txt @@ -19,3 +19,4 @@ django-recaptcha-works python-openid pystache==0.3.1 pytz +longerusername |