Home | Trees | Indices | Help |
|
---|
|
object --+ | Field --+ | DictField
Field type for nested dictionaries.
>>> from couchdb import Server >>> server = Server('http://localhost:5984/') >>> db = server.create('python-tests')
>>> class Post(Document): ... title = TextField() ... content = TextField() ... author = DictField(Schema.build( ... name = TextField(), ... email = TextField() ... )) ... extra = DictField()
>>> post = Post( ... title='Foo bar', ... author=dict(name='John Doe', ... email='john@doe.com'), ... extra=dict(foo='bar'), ... ) >>> post.store(db) #doctest: +ELLIPSIS <Post ...> >>> post = Post.load(db, post.id) >>> post.author.name u'John Doe' >>> post.author.email u'john@doe.com' >>> post.extra {'foo': 'bar'}
>>> del server['python-tests']
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 |