Home | Trees | Indices | Help |
|
---|
|
object --+ | Field --+ | ListField
Field type for sequences of other fields.
>>> from couchdb import Server >>> server = Server('http://localhost:5984/') >>> db = server.create('python-tests')
>>> class Post(Document): ... title = TextField() ... content = TextField() ... pubdate = DateTimeField(default=datetime.now) ... comments = ListField(DictField(Schema.build( ... author = TextField(), ... content = TextField(), ... time = DateTimeField() ... )))
>>> post = Post(title='Foo bar') >>> post.comments.append(author='myself', content='Bla bla', ... time=datetime.now()) >>> len(post.comments) 1 >>> post.store(db) #doctest: +ELLIPSIS <Post ...> >>> post = Post.load(db, post.id) >>> comment = post.comments[0] >>> comment['author'] 'myself' >>> comment['content'] 'Bla bla' >>> comment['time'] #doctest: +ELLIPSIS '...T...Z'
>>> del server['python-tests']
Nested Classes | |
Proxy |
Instance Methods | |||
|
|||
Inherited from Inherited from |
Properties | |
Inherited from |
Method Details |
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Aug 19 11:10:46 2009 | http://epydoc.sourceforge.net |