Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean inference in enums #1615

Closed
wants to merge 4 commits into from
Closed

Conversation

davidmiller
Copy link
Member

refs #1540

I think we should merge this already as an interim improvement and close the PR at 0.11

rossjones and others added 4 commits June 18, 2018 16:59
Where a field is a BooleanField or a NullBooleanField inference should
generate a lookup list with `[Yes, No]` and `[Yes, No, Unknown]` as
options (for radio buttons).

This will require changes to templates/radio.html so that Unkown does
not use Unknown as a value, instead leaving the value empty so that we
know the intended value is None.

This would be easier if lookuplists were tuples (like choices in Django)
so I'm considering implementing support for lists of tuples (as well as
the current list of strings) for lookuplists - the alternative is too
much logic in the template and special-casing the string 'Unknown'

Will fix #1540
@fredkingham
Copy link
Contributor

I think we need to rethink this. There are 2 options.

  1. Move logic into the field translator and do a hard coded if field type == Boolean or NullBoolean then translate yes, no, unknown accordingly.

  2. Use logic similar to what is included here but change it so that we use a dictionary which populates value. I'm pro the latter as it doesn't require angular. The problem is any instances where we have hardcoded lookup list properties that currently takes a string that we include as javascript in the template.

Its an interesting one, but lets hold off for the time being.

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.

3 participants