Skip to content

Commit

Permalink
issue #39
Browse files Browse the repository at this point in the history
  • Loading branch information
maxtepkeev committed Jul 31, 2014
1 parent 44f5d8c commit b9d8c42
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
---------

0.8.3 (2014-08-XX)
++++++++++++++++++

- Fixed: `Issue #39 <https://github.com/maxtepkeev/python-redmine/issues/39>`__ (It was
impossible to save custom_fields in User resource via ``new()`` method)

0.8.2 (2014-05-27)
++++++++++++++++++

Expand Down
8 changes: 6 additions & 2 deletions docs/resources/user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
<redmine.resources.User #32 "John Smith">
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion redmine/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b9d8c42

Please sign in to comment.