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

Mixed Classes in a DictProperty? #162

Open
ghost opened this issue Mar 12, 2019 · 0 comments
Open

Mixed Classes in a DictProperty? #162

ghost opened this issue Mar 12, 2019 · 0 comments

Comments

@ghost
Copy link

ghost commented Mar 12, 2019

Wondering how can I mix different classes in a DictProperty. For example, in the example below I have 2 different classes that I would like to map to 'actions' DictProperty attribute.
Couldn't find any knob in the tests or documentation. Appreciate any comments about it.

# generic class
class Action(orm.JsonObject):
    pass
# action class 1
class EmailAction(Action):
    action = 'email'
    subject = orm.StringProperty()
    ...
# action class 2
class PagerAction(Action):
    action = 'pager'
    queues = orm.ListProperty(orm.StringProperty)
    ...
# using DictProperty to get it together
class Alert(orm.JsonObject):
    actions = orm.DictProperty(Action)
    ...
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

No branches or pull requests

0 participants