Skip to content
This repository was archived by the owner on Jul 14, 2020. It is now read-only.
This repository was archived by the owner on Jul 14, 2020. It is now read-only.

Document init from dict should update from default_values first #239

@YiuTerran

Description

@YiuTerran

When specified doc for Document, i found the generated object not has default_values if the doc not have. For example:

class MyDoc(Document):
    structure={
        'name': unicode,
        'phone': basestring
    }
    default_values = {
         'phone': ''
   }

Then t=MyDoc({'name': 'xxx'}) will generate a dict not include default phone at all.

I think there should be a para like set_default=True to include all default values... It is convenient for create model from POST data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions