Created
January 28, 2020 12:31
-
-
Save uday12kumar/c5c98572a236669f11127d39eda32dfb 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
@classmethod | |
def book(cls, id, seats_selected): | |
with transaction.atomic(): | |
if seats < self.seats_selected: | |
raise errors.InsufficientSeats() | |
slot = (cls.objects.select_for_update().get(id=id)) | |
slot.seats -= seats_selected | |
slot.save() | |
return slot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment