py-trello
py-trello copied to clipboard
requesting help - get custom field value
I am trying to get value of a custom field for a card that I obtain using
all cards = board.get_cards({'filter' : 'open', 'fields' : 'all'})
for card in all_cards:
# "Completed" is a checkbox on the board and may or may not be checked on the card in question
is_complete = card.get_custom_field_by_name('Completed')
if is_complete:
print('This card is complete')
However, the above code does not seem to capture when Completed check box is checked on the card.
If instead, I do,
card.fetch()
# and then
print(card._customFields[0].value)
Then it prints the value as True. However, in this case there is only one checkbox on the card that is checked. If another one is checked, I will have to run a loop on this list. Which does not make sense to do because you have already enabled that capability in your python library.
Thanks for your help.
is_complete will be the customfield object, you need to do something like:
is_complete = card.get_custom_field_by_name('Completed').value that should give you your boolean
Thank you @jdmry. I think my Github alert did not work and I read this comment now.