Commit 8446b1d7 by Felipe Lavratti

Added `remove` method on `Object`

The `remove` method works like the `increment` method of the `Object` class, but instead incrementing it clears a column value.
parent 70d5343c
......@@ -455,6 +455,19 @@ class Object(six.with_metaclass(ObjectMetaclass, ParseResource)):
}
self.__class__.PUT(self._absolute_url, **payload)
self.__dict__[key] += amount
def remove(self, key):
"""
Clear a column value in the object. Note that this happens immediately:
it does not wait for save() to be called.
"""
payload = {
key: {
'__op': 'Delete'
}
}
self.__class__.PUT(self._absolute_url, **payload)
del self.__dict__[key]
def removeRelation(self, key, className, objectsId):
self.manageRelation('RemoveRelation', key, className, objectsId)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment