# HG changeset patch # User Marcin Kuzminski # Date 2019-10-31 09:28:13 # Node ID 8d4c4139309bb2f772dc72d43f9003aac31e1410 # Parent ad2b487a04ddfc62394bd97c1645f76461631e82 users: add edition of description in admin view for users diff --git a/rhodecode/apps/my_account/views/my_account.py b/rhodecode/apps/my_account/views/my_account.py --- a/rhodecode/apps/my_account/views/my_account.py +++ b/rhodecode/apps/my_account/views/my_account.py @@ -599,6 +599,7 @@ class MyAccountView(BaseAppView, DataGri 'email': c.user.email, 'firstname': c.user.firstname, 'lastname': c.user.lastname, + 'description': c.user.description, } c.form = forms.RcForm( schema, appstruct=appstruct, diff --git a/rhodecode/model/forms.py b/rhodecode/model/forms.py --- a/rhodecode/model/forms.py +++ b/rhodecode/model/forms.py @@ -143,6 +143,7 @@ def UserForm(localizer, edit=False, avai firstname = v.UnicodeString(strip=True, min=1, not_empty=False) lastname = v.UnicodeString(strip=True, min=1, not_empty=False) email = All(v.UniqSystemEmail(localizer, old_data), v.Email(not_empty=True)) + description = v.UnicodeString(strip=True, min=1, max=250, not_empty=False) extern_name = v.UnicodeString(strip=True) extern_type = v.UnicodeString(strip=True) language = v.OneOf(available_languages, hideList=False, diff --git a/rhodecode/model/user.py b/rhodecode/model/user.py --- a/rhodecode/model/user.py +++ b/rhodecode/model/user.py @@ -179,6 +179,7 @@ class UserModel(BaseModel): 'email': user.email, 'firstname': user.name, 'lastname': user.lastname, + 'description': user.description, 'active': user.active, 'admin': user.admin, 'extern_name': user.extern_name, @@ -225,7 +226,8 @@ class UserModel(BaseModel): active=True, admin=False, extern_type=None, extern_name=None, cur_user=None, plugin=None, force_password_change=False, allow_to_create_user=True, create_repo_group=None, - updating_user_id=None, language=None, strict_creation_check=True): + updating_user_id=None, language=None, description=None, + strict_creation_check=True): """ Creates a new instance if not found, or updates current one @@ -356,6 +358,7 @@ class UserModel(BaseModel): new_user.extern_type = safe_unicode(extern_type) new_user.name = firstname new_user.lastname = lastname + new_user.description = description # set password only if creating an user or password is changed if not edit or _password_change(new_user, password): diff --git a/rhodecode/model/validation_schema/schemas/user_schema.py b/rhodecode/model/validation_schema/schemas/user_schema.py --- a/rhodecode/model/validation_schema/schemas/user_schema.py +++ b/rhodecode/model/validation_schema/schemas/user_schema.py @@ -167,6 +167,12 @@ class UserProfileSchema(colander.Schema) lastname = colander.SchemaNode( colander.String(), missing='', title='Last name') + description = colander.SchemaNode( + colander.String(), missing='', title='Personal Description', + widget=forms.widget.TextAreaWidget(), + validator=colander.Length(max=250) + ) + email = colander.SchemaNode( colander.String(), widget=deferred_user_email_in_emails_widget, validator=deferred_user_email_in_emails_validator, @@ -176,6 +182,7 @@ class UserProfileSchema(colander.Schema) ) + class AddEmailSchema(colander.Schema): current_password = colander.SchemaNode( colander.String(), diff --git a/rhodecode/templates/admin/users/user_edit_profile.mako b/rhodecode/templates/admin/users/user_edit_profile.mako --- a/rhodecode/templates/admin/users/user_edit_profile.mako +++ b/rhodecode/templates/admin/users/user_edit_profile.mako @@ -68,6 +68,14 @@
+ +
+
+ ${h.textarea('description', class_="medium")} +
+
+
+
${_('New Password')}: