Skip to content

Added another format for registration field options - #494

Merged
mariajgrimaldi merged 1 commit into
masterfrom
MJG/add_options_format
Feb 3, 2021
Merged

Added another format for registration field options#494
mariajgrimaldi merged 1 commit into
masterfrom
MJG/add_options_format

Conversation

@mariajgrimaldi

Copy link
Copy Markdown
Contributor

This PR adds a new format for registration field options, it allows us to use:

Format 1:

"options": [option1, ...., optionN]

Format 2:

"options": {"value": "name", ..., "valueN": "nameN"}

if field_options:
field_options = [(six.text_type(option.lower()), option) for option in field_options]
try:
field_options = [(six.text_type(value.lower()), name) for value, name in field_options.items()]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I think that we should try first the old format (field_options = [(six.text_type(value.lower()), value) for value in field_options]) and if that fails use the new format. What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But how the old format would fail? 🤔

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. My bad😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants