def handle(self, tour_slug, *args, **kwargs): if len(args) > 0: username = args[0] confirm = raw_input(CONFIRM_FOR_SINGLE_USER.format(tour_slug=tour_slug, username=username)) if confirm == "yes": user = User.objects.filter(username=username).first() GuidedTour.mark_as_seen(user, tour_slug) print("Complete") else: confirm = raw_input(CONFIRM_FORM_ALL_USERS.format(tour_slug=tour_slug)) if confirm == "yes": for user in User.objects.all(): sys.stdout.write(".") GuidedTour.mark_as_seen(user, tour_slug) sys.stdout.write("\n") print("Complete")
def handle(self, tour_slug, *args, **kwargs): if len(args) > 0: username = args[0] confirm = input(CONFIRM_FOR_SINGLE_USER.format( tour_slug=tour_slug, username=username)) if confirm == 'yes': user = User.objects.filter(username=username).first() GuidedTour.mark_as_seen(user, tour_slug) print("Complete") else: confirm = input(CONFIRM_FORM_ALL_USERS.format(tour_slug=tour_slug)) if confirm == 'yes': for user in User.objects.all(): sys.stdout.write(".") GuidedTour.mark_as_seen(user, tour_slug) sys.stdout.write("\n") print("Complete")
def post(self, request, *args, **kwargs): GuidedTour.mark_as_seen(request.user, kwargs['tour_slug']) return HttpResponse("success")
def test_mark_as_seen(self): GuidedTour.mark_as_seen(self.test_user, TEST_TOUR.slug) self.assertFalse(TEST_TOUR.is_enabled(self.test_user))