Posted By

tamuratetsuya on 12/11/08


Tagged

google python engine app django


Versions (?)

Transactionについて


 / Published in: Python
 

  1. class MyModel1(db.Model):
  2. text = db.StringProperty()
  3. anotherModelInfo = db.NumberProperty()
  4. class MyModel2(db.Model):
  5. ref = db.ReferenceProperty(MyModel1)
  6.  
  7. class Controller(webapp.RequestHandler):
  8. def post(self):
  9. datas = []
  10. ... # MyModelのlistであるdatasを作成。
  11. db.run_in_transaction(self.insert, datas)
  12.  
  13. def insert(datas):
  14. for data in datas:
  15. data.put()

Report this snippet  

You need to login to post a comment.