コード例 #1
0
 def handle(self, *args, **kwargs):
     now = timezone.now()
     meal_list = Meal.objects.filter(
         scheduled_for__lt=now,
         review__isnull=True,
         status='a',
     )
     for meal in meal_list:
         print "Creating a KitchenReview object and sending email " \
             "for meal with ID: %d" % meal.id
         token = get_random_string()
         kitchen_review = KitchenReview.objects.create(
             token=token,
             guest=meal.guest,
             kitchen=meal.kitchen,
         )
         meal.review = kitchen_review
         meal.save()
         Notification.notify(
             'invite_guest_review', {
                 'to_address': meal.guest.email,
                 'meal': meal,
                 'kitchen_review': kitchen_review,
             }
         )
コード例 #2
0
ファイル: models.py プロジェクト: pabloportela/narda
 def notify(self):
     # Guest confirmation
     Notification.notify('book_guest', {
         'to_address': self.guest.email,
         'meal': self,
     })
     # Chef confirmation
     Notification.notify('book_chef', {
         'to_address': self.kitchen.chef.email,
         'meal': self,
     })