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

Support default values for attributes #1

Open
chasefinch opened this issue Oct 5, 2021 · 0 comments
Open

Support default values for attributes #1

chasefinch opened this issue Oct 5, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@chasefinch
Copy link
Owner

Would be good to have some attributes allow a default value that's set when the attribute name is omitted. This might mean that the syntax for "is_unique" needs to be more explicit. For example:

class Currency(DataEnum)
    data_attributes = (
        ('code', dict(is_unique=True)),  # Simple syntax ('code', True) would also still be allowed
        ('symbol', dict(default='$')),
    )

Currency.CAD = Currency(code='CAD')  # Uses default symbol '$'
@chasefinch chasefinch added the enhancement New feature or request label Oct 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant