Hello, assume I have this little model:
class Deal(models.Model):
purchases = models.IntegerField(default=0)#amount of purchases so far
increase_purchases(self,to_add):
self.update( purchases =self.purchases + to_add)
when I try to use this increase_purchases model from shell:
>>> x = Deal.objects.get(id=1)
>>> x.increase_purchases(4)
AttributeError: 'Deal' object has no attribute 'update'
How can I write a proper function to the model so that I can update the selected querys purchases as I want ?