from django.utils.encoding import smart_unicode
from general import NextUrlField, UserNameField
-from forum import settings
+from forum import settings, REQUEST_HOLDER
from forum.modules import call_all_handlers
def __init__(self, user, *args, **kwargs):
super(EditUserForm, self).__init__(*args, **kwargs)
- if settings.EDITABLE_SCREEN_NAME:
+ if settings.EDITABLE_SCREEN_NAME or (REQUEST_HOLDER.request.user.is_authenticated() and REQUEST_HOLDER.request.user.is_superuser):
self.fields['username'] = UserNameField(label=_('Screen name'))
self.fields['username'].initial = user.username
self.fields['username'].user_instance = user
#todo: temporary thing, for now lets just assume that the site owner will always be the first user of the application
return self.id == 1
- @property
- def decorated_name(self):
+
+ def _decorated_name(self):
username = smart_unicode(self.username)
if len(username) > TRUNCATE_USERNAMES_LONGER_THAN and TRUNCATE_LONG_USERNAMES:
return username
+ @property
+ def decorated_name(self):
+ return self._decorated_name()
+
@property
def last_activity(self):
try: