def post(self, request): phone = request.POST["phone"] code = str(randint(1000, 9999)) message = "Your PIN code is: " + code request.session["code"] = code twilio_helper.send_sms(phone, message) return HttpResponse("Message sent")
def save(self, *args, **kwargs): self.full_clean() super(Transaction, self).save(*args, **kwargs) for i in range((self.end_date-self.start_date).days + 1): not_available = self.start_date + datetime.timedelta(days=i) GearAvailability.objects.create(not_available_date=not_available, gear=self.gear) twilio_helper.send_sms( phone = self.owner_user.phone, text = "Your {} just got booked from {} to {}".format(self.gear, self.start_date, self.end_date)) twilio_helper.send_sms( phone = self.borrower_user.phone, text = "You just booked a {} from {} to {}".format(self.gear, self.start_date, self.end_date))
def save(self, *args, **kwargs): self.full_clean() super(Transaction, self).save(*args, **kwargs) for i in range((self.end_date - self.start_date).days + 1): not_available = self.start_date + datetime.timedelta(days=i) GearAvailability.objects.create(not_available_date=not_available, gear=self.gear) twilio_helper.send_sms( phone=self.owner_user.phone, text="Your {} just got booked from {} to {}".format( self.gear, self.start_date, self.end_date)) twilio_helper.send_sms( phone=self.borrower_user.phone, text="You just booked a {} from {} to {}".format( self.gear, self.start_date, self.end_date))