Skip to content

Commit

Permalink
Merge pull request #120 from holvi/toivotuo-support-cloning
Browse files Browse the repository at this point in the history
Add cloning from a source card to add_card()
  • Loading branch information
sarumont committed Jan 11, 2016
2 parents db04969 + 1d3464d commit b78b5fd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions trello/trellolist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand All @@ -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):
Expand Down

0 comments on commit b78b5fd

Please sign in to comment.