コード例 #1
0
ファイル: _db.py プロジェクト: esoprana/pyTirocinioAI
class User(Document):
    """
    :ivar str username:
    :ivar uuid googleSessionId
    """

    username = fields.StringField(required=True, null=False)
    googleSessionId = fields.UUIDField(required=True, null=False)
コード例 #2
0
ファイル: models.py プロジェクト: malinich/wli_routers
class Route(Document, metaclass=MetaBaseTemplate):
    author = fields.UUIDField(required=True)
    title = fields.StringField(validate=validate.Length(max=255),
                               required=True)
    vectors = fields.ListField(fields.EmbeddedField(Vector), missing=list)
    is_public = fields.BooleanField(missing=False, default=False)
    created = fields.DateTimeField(missing=datetime.utcnow)

    class Meta:
        collection_name = "routes"
コード例 #3
0
 class MySchema(Schema):
     string = fields.StringField()
     uuid = fields.UUIDField()
     number = fields.NumberField()
     integer = fields.IntegerField()
     decimal = fields.DecimalField()
     boolean = fields.BooleanField()
     float = fields.FloatField()
     url = fields.UrlField()
     email = fields.EmailField()
     constant = fields.ConstantField("const")
コード例 #4
0
ファイル: test_fields.py プロジェクト: niavlys/umongo
 class MySchema(EmbeddedSchema):
     string = fields.StringField()
     uuid = fields.UUIDField()
     number = fields.NumberField()
     integer = fields.IntegerField()
     decimal = fields.DecimalField()
     boolean = fields.BooleanField()
     formattedstring = fields.FormattedStringField('Hello {to_format}')
     float = fields.FloatField()
     # localdatetime = fields.LocalDateTimeField()
     url = fields.UrlField()
     email = fields.EmailField()
     constant = fields.ConstantField("const")
コード例 #5
0
class Blog(Document, metaclass=MetaBaseTemplate):
    __collection__ = 'blog'

    title = fields.StringField(validate=validate.Length(max=128),
                               required=True)
    text = fields.StringField(validate=validate.Length(min=128), required=True)
    user = fields.UUIDField(required=True)
    created = fields.DateTimeField(missing=datetime.datetime.now)
    comments = fields.ListField(fields.EmbeddedField(Comment), missing=list)
    areal = fields.EmbeddedField(Areal, missing=dict)

    class Meta:
        pass
コード例 #6
0
ファイル: models.py プロジェクト: malinich/wli_images
class ImageDocument(Document, metaclass=MetaBaseTemplate):
    public_id = fields.StringField(required=True)
    filename = fields.StringField()
    tags = fields.ListField(fields.StringField, missing=list)
    url = fields.UrlField(required=True)
    signature = fields.StringField()
    etag = fields.StringField()

    user = fields.UUIDField(required=True)
    liked = fields.IntegerField(missing=0)
    created_at = fields.DateTimeField(missing=datetime.utcnow)

    class Meta:
        collection_name = "images"
コード例 #7
0
class Users(Document, metaclass=MetaBaseTemplate):
    __collection__ = "users"
    email = fields.EmailField(required=True, unique=True)
    guid = fields.UUIDField(missing=uuid.uuid4)
    name = fields.StringField(validate=validate.Length(max=50), required=True)
    picture = fields.UrlField()
    password = fields.StringField(load_only=True)

    class Meta:
        pass
        # indexes = ("email",)

    @classmethod
    def create_password(cls, passwd):
        m = hashlib.sha256()
        m.update(passwd)
        return m.hexdigest()
コード例 #8
0
class Comment(EmbeddedDocument, metaclass=MetaBaseTemplate):
    user = fields.UUIDField(required=True)
    text = fields.StringField(validate=validate.Length(min=3), required=True)
    created = fields.DateTimeField(missing=datetime.datetime.utcnow)
コード例 #9
0
class IncorrectTempl(Document):
    birthday = fields.UUIDField(required=True)