Ejemplo n.º 1
0
class SimpleDoc(Document):
    __collection__ = 'testdocs'

    oid = ObjectIdField()
    b = BooleanField()
    s = StringField()
    i = IntegerField()
    e = EmailField()
    email = StringField()
Ejemplo n.º 2
0
class SimpleDoc(Document):
    __collection__ = 'testdocs'

    oid = ObjectIdField()
    b = BooleanField()
    s = StringField()
    i = IntegerField()
    e = EmailField()
    email = StringField()
    not_set = StringField()

    def __fake__email__(self, faker, depth):
        return faker.email()

    def __fake__not_set__(self, faker, depth):
        return AttributeNotSet
Ejemplo n.º 3
0
    class Doc(Document):
        i = IntegerField()
        s = StringField()

        def __fake__(self, values, faker, depth):
            assert values['i'] == 13
            assert 's' not in values
            new_values = values.copy()
            new_values['i'] += 1
            new_values['s'] = 'string'
            return new_values
Ejemplo n.º 4
0
class RefDoc(Document):
    __collection__ = 'refs'

    s = StringField()
Ejemplo n.º 5
0
class Doc(Document):
    __collection__ = 'docs'

    i = IntegerField()
    s = StringField()
    ref = ReferenceField(RefDoc)
Ejemplo n.º 6
0
class Qux(EmbeddedDocument):
    f = StringField('quux')
Ejemplo n.º 7
0
class EmbeddedDoc(EmbeddedDocument):
    __collection__ = 'testdocs'

    name = StringField()