From 1d3464de716983516dd396280afd5cfcdcef94e1 Mon Sep 17 00:00:00 2001 From: Tuomas Toivonen Date: Mon, 11 Jan 2016 14:28:00 +0000 Subject: [PATCH] Add cloning from a source card to add_card() --- trello/trellolist.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/trello/trellolist.py b/trello/trellolist.py index 60139abd..9c5f0a7e 100644 --- a/trello/trellolist.py +++ b/trello/trellolist.py @@ -45,12 +45,14 @@ def list_cards(self, card_filter="open"): json_obj = self.client.fetch_json('/lists/' + self.id + '/cards/' + card_filter) return [Card.from_json(self, c) for c in json_obj] - def add_card(self, name, desc=None, labels=[], due="null"): + def add_card(self, name, desc=None, labels=[], due="null", source=None): """Add a card to this list :name: name for the card :desc: the description of the card :labels: a list of label IDs to be added + :due: due date for the card + :source: card ID from which to clone from :return: the card """ labels_str = "" @@ -59,7 +61,7 @@ def add_card(self, name, desc=None, labels=[], due="null"): json_obj = self.client.fetch_json( '/cards', http_method='POST', - post_args={'name': name, 'idList': self.id, 'desc': desc, 'idLabels': labels_str[:-1], 'due': due}) + post_args={'name': name, 'idList': self.id, 'desc': desc, 'idLabels': labels_str[:-1], 'due': due, 'idCardSource': source}) return Card.from_json(self, json_obj) def archive_all_cards(self):