From 4896cf0df68b68e931e621b7cb160fd566ae182d Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Fri, 19 Dec 2014 09:12:24 +0100 Subject: [PATCH] Task: List all non-readable fields as modified when creating new task --- tasklib/task.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tasklib/task.py b/tasklib/task.py index 1202437..36f3c3b 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -201,8 +201,18 @@ class Task(TaskResource): def _get_modified_fields_as_args(self): args = [] - for field in self._modified_fields: - args.append('{}:{}'.format(field, self._data[field])) + + # If we're modifying saved task, simply pass on all modified fields + if self.saved: + for field in self._modified_fields: + args.append('{0}:{1}'.format(field, self._data[field])) + # For new tasks, pass all fields that make sense + else: + for field in self._data.keys(): + if field in self.read_only_fields: + continue + args.append('{0}:{1}'.format(field, self._data[field])) + return args def refresh(self, only_fields=[]): -- 2.39.5