Skip to content

Instantly share code, notes, and snippets.

@fchevitarese
Created December 8, 2017 16:12
Show Gist options
  • Save fchevitarese/a1c9839b67cf15500733a68e584b4972 to your computer and use it in GitHub Desktop.
Save fchevitarese/a1c9839b67cf15500733a68e584b4972 to your computer and use it in GitHub Desktop.
def save(self, *args, **kwargs):
if self.title.stock >= self.quantity:
self.title.stock -= self.quantity
super(Item, self).save(*args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment