diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e9da0e8..e4c4d33 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ Changelog --------- +0.8.3 (2014-08-XX) +++++++++++++++++++ + +- Fixed: `Issue #39 `__ (It was + impossible to save custom_fields in User resource via ``new()`` method) + 0.8.2 (2014-05-27) ++++++++++++++++++ diff --git a/docs/resources/user.rst b/docs/resources/user.rst index 0bdcbc2..f757c8a 100644 --- a/docs/resources/user.rst +++ b/docs/resources/user.rst @@ -28,11 +28,12 @@ create :param string lastname: (required). User surname. :param string mail: (required). User email. :param integer auth_source_id: (optional). Authentication mode id. + :param list custom_fields: (optional). Custom fields in the form of [{'id': 1, 'value': 'foo'}]. :return: User resource object .. code-block:: python - >>> user = redmine.user.create(login='jsmith', password='qwerty', firstname='John', lastname='Smith', mail='john@smith.com', auth_source_id=1) + >>> user = redmine.user.create(login='jsmith', password='qwerty', firstname='John', lastname='Smith', mail='john@smith.com', auth_source_id=1, custom_fields=[{'id': 1, 'value': 'foo'}, {'id': 2, 'value': 'bar'}]) >>> user @@ -58,6 +59,7 @@ new >>> user.lastname = 'Smith' >>> user.mail = 'john@smith.com' >>> user.auth_source_id = 1 + >>> user.custom_fields = [{'id': 1, 'value': 'foo'}, {'id': 2, 'value': 'bar'}] >>> user.save() True @@ -190,11 +192,12 @@ update :param string lastname: (optional). User surname. :param string mail: (optional). User email. :param integer auth_source_id: (optional). Authentication mode id. + :param list custom_fields: (optional). Custom fields in the form of [{'id': 1, 'value': 'foo'}]. :return: True .. code-block:: python - >>> redmine.user.update(1, login='jsmith', password='qwerty', firstname='John', lastname='Smith', mail='john@smith.com', auth_source_id=1) + >>> redmine.user.update(1, login='jsmith', password='qwerty', firstname='John', lastname='Smith', mail='john@smith.com', auth_source_id=1, custom_fields=[{'id': 1, 'value': 'foo'}, {'id': 2, 'value': 'bar'}]) True save @@ -218,6 +221,7 @@ save >>> user.lastname = 'Smith' >>> user.mail = 'john@smith.com' >>> user.auth_source_id = 1 + >>> user.custom_fields = [{'id': 1, 'value': 'foo'}, {'id': 2, 'value': 'bar'}] >>> user.save() True diff --git a/redmine/resources.py b/redmine/resources.py index b0825db..e246da3 100644 --- a/redmine/resources.py +++ b/redmine/resources.py @@ -618,7 +618,7 @@ class User(_Resource): _includes = ('memberships', 'groups') _unconvertible = ('status',) - _readonly = _Resource._readonly + ('api_key', 'last_login_on', 'custom_fields') + _readonly = _Resource._readonly + ('api_key', 'last_login_on') def __str__(self): try: