Created
August 3, 2017 11:41
-
-
Save kidig/d5438851547c455159845c462a02e9c2 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
finish_statuses = ['finished', 'cancelled'] | |
if self.status == self.STATUS_FINISHED: | |
if not self.event_type == self.TYPE_DELIVERY: | |
delivery = self.booking.booking_events.filter(event_type=self.TYPE_DELIVERY).first() | |
if delivery and delivery.status not in [finish_statuses]: | |
raise ValidationError({'status': ['Please finish/cancel delivery event first.']}) | |
# delivery.status = 'finished' | |
# but | |
# delivery.status not in [finish_statuses] is FALSE! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment