Skip to content

Ensure description if risk_technical#1148

Merged
jaredlockhart merged 1 commit intomozilla:masterfrom
robhudson:1082-fix
Apr 5, 2019
Merged

Ensure description if risk_technical#1148
jaredlockhart merged 1 commit intomozilla:masterfrom
robhudson:1082-fix

Conversation

@robhudson
Copy link

Fixes #1082

@robhudson robhudson requested a review from jaredlockhart April 4, 2019 18:33
Copy link
Collaborator

@jaredlockhart jaredlockhart left a comment

Choose a reason for hiding this comment

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

Thank you @robhudson looks good, just one change.

class ExperimentRisksForm(ChangeLogMixin, forms.ModelForm):
RADIO_OPTIONS = ((False, "No"), (True, "Yes"))

def coerce_truthy(value):

This comment was marked as outdated.

help_text=Experiment.RISK_INTERNAL_ONLY_HELP_TEXT,
choices=RADIO_OPTIONS,
widget=RadioWidget,
coerce=coerce_truthy,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can just say coerce=bool here?

Copy link
Author

Choose a reason for hiding this comment

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

The value getting passed to these is a string of either "True" or "False" which come from the RADIO_OPTIONS after going through a string conversion in Django-land. And bool("False") => True which isn't what we want.

Copy link
Collaborator

@jaredlockhart jaredlockhart left a comment

Choose a reason for hiding this comment

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

@robhudson Looks good, thank you!

@jaredlockhart jaredlockhart merged commit df3a7a7 into mozilla:master Apr 5, 2019
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