Created
August 3, 2016 20:22
-
-
Save pirate/ea97440bac8fa7a00b3ff55d67eb37e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def save(self, *args, **kwargs): | |
if self.id: | |
on_disk = Game.objects.get(pk=self.id) | |
if on_disk.modified > self.modified: | |
raise StaleWriteError('Tried to save outdated Game') | |
super(Game, self).save(*args, **kwargs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment