Return to Snippet

Revision: 10175
at December 11, 2008 03:24 by tamuratetsuya


Initial Code
class MyModel1(db.Model):
 title = StringProperty()
class MyModel2(db.Model):
 ref = ReferenceProperty(MyModel1)
 otherRef = ReferenceProperty(OtherModel)

def method():
  model1 = MyModel1.get_by_id(int(idString))
  model2s = MyModel2.gql("WHERE ref = :ref", ref=model1)
  db.run_in_transaction(delete_cascade, model1, model2s)

def delete_cascade(model1, model2s)
 db.delete(model2s)
 model1.delete()

Initial URL

                                

Initial Description

                                

Initial Title
Transactionについて 2

Initial Tags
google, python, django

Initial Language
Python