from datetime import datetime import db from couchdb import schema as

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from datetime import datetime
import db
from couchdb import schema as s
class Post(db.Model):
TYPE = 'post'
title = s.TextField()
type = s.TextField(default=TYPE)
body = s.TextField()
created = s.DateTimeField(default=datetime.now())
def fill():
post_data = [
{'title': 'First post', 'body': 'The body of the first post'},
{'title': 'Second post', 'body': 'The body of the second post'},
]
for item in post_data:
post = Post(**item)
post.save()
fill()