google app engine - Delete ndb entity using the key.id() -
i have key id of entity want delete, when trying delete using get_by_id, not deleting entity (it's not doing anything).
the numerical id (i assume number, not string) stored in 'key' data:
d = car_database.car() ident = self.request.get('key') d.get_by_id(ident).delete()
the id in instance is: 5659313586569216
thanks help
this incorrect. please @ documentation on deleting entities - https://cloud.google.com/appengine/docs/python/ndb/entities#deleting_entities - it's pretty clear should doing.
in case should
ident = self.request.get('key') d = car_database.car.get_by_id(ident) if d: d.key.delete()
note get_by_id
in fact classmethod don't need instantiate in instance of car
use it.
and delete
method of key
, not of model
.
Comments
Post a Comment