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 mixins in (Embedded)Document definition #267

Merged
merged 1 commit into from May 4, 2020
Merged

Support mixins in (Embedded)Document definition #267

merged 1 commit into from May 4, 2020

Conversation

lafrech
Copy link
Collaborator

@lafrech lafrech commented May 3, 2020

Closes #188.

This PR allows to use Mixin classes in Document and EmbeddedDocument definition.

It only works if the Mixin is declared first (leftmost) in the Document definition.

class MyMixin:
    a = fields.IntField()

class MyDoc(MyMixin, Document):  # Mixin first
    b = fields.IntField()

@lafrech lafrech added this to the 3.0 milestone May 3, 2020
@coveralls
Copy link

coveralls commented May 3, 2020

Coverage Status

Coverage increased (+0.006%) to 95.695% when pulling c9a8664 on mixins into 2f3322c on master.

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.

Use mixins in schema declarations
2 participants