Skip to content

Instantly share code, notes, and snippets.

@jgorset
Created February 22, 2011 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgorset/838488 to your computer and use it in GitHub Desktop.
Save jgorset/838488 to your computer and use it in GitHub Desktop.
class Call(models.Model):
call_at = models.DateTimeField()
contestant = models.OneToOneField(Contestant)
confirmed = models.BooleanField()
def confirm(self):
self.confirmed = True
self.save()
def save(self, *args, **kwargs):
if not self.id:
created = True
call = super(Call, self).save(*args, **kwargs)
if created:
# Dispatch an SMS requesting confirmation that this phone
# number is in fact the contestant's phone number.
message = OutgoingSMS.objects.create(
recipient = self.contestant.phone_number,
sender = 'Bademiljø',
message = '-'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment