/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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()