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

#2714 fields with associated free other value #2786

Merged
merged 3 commits into from
Jul 28, 2022

Conversation

iamleeg
Copy link
Contributor

@iamleeg iamleeg commented Jul 27, 2022

If one of the enumerated values in a field is 'other', then you get (at no additional cost to the purchaser) a string field named fieldName_other where we can store the free text value.

@@ -60,14 +60,21 @@ def from_dict(cls, dictionary):
def python_type(self) -> type:
return self.model_type(self.type)

def dataclasses_tuple(self) -> (str, type, dataclasses.Field):
def dataclasses_tuples(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

-> (str, type, dataclasses.Field)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be -> List[(str, type, dataclasses.Field)] but I couldn't get the type checker in Python 3.10 to accept that. Maybe a bug in the type checker? Anyway it wouldn't load the module so I removed the type hint.

Copy link
Contributor

Choose a reason for hiding this comment

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

list[tuple[str, type, dataclasses.Field]] should work (from typing import List, Tuple not required anymore)

@iamleeg iamleeg merged commit 7a2832b into main Jul 28, 2022
@iamleeg iamleeg deleted the 2714_fields_with_associated_free_other_value branch July 28, 2022 08:04
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.

None yet

3 participants