Skip to content

Custom Field 'checked' changed to "checkbox' and this affects post_args because the post arg has remained unchanged #346

@xu2xulim

Description

@xu2xulim

There is some inconsistency found in set_custom_fields for what used to be type = 'checked'

if custom_field.field_type in ['text', 'number', 'date', 'checked']:
            if value == "":
                post_args = {'value': ""}
            else:
                post_args = {'value': {str(custom_field.field_type): value}}

The Trello api documentation is as follows

The type of Custom Field to create.

Valid values: checkbox, list, number, text, date

But when updating a CF it is still using {'checked' : value}...below is copied from the example from Trello API document

{
  "value": {
    "text": "<string>",
    "checked": true,
    "date": "2018-03-13T16:00:00.000Z",
    "number": 2154
  }
}

Above seems to be validate during my test.
I changed
if custom_field.field_type in ['text', 'number', 'date', 'checked']:
to
if custom_field.field_type in ['text', 'number', 'date', '**checkbox**]:

and hardcoded this
post_args = {'value': {str(custom_field.field_type): value}}
as
post_args = {'value': 'checked' : value}}

and my code was able to execute

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions