def get(self, request): if request.user.groups.filter(name="cachers").exists(): shift = ShiftUser() shift.save() return redirect('/cashier') else: return redirect('/test')
def setUpTestData(cls): cls.test_shift = ShiftUser() cls.test_shift.state = True cls.test_shift.save() STATUS = ['pay', 'wait_moder', 'wait_pay', 'post', 'no_moder'] for status in STATUS: status = SoundStatus.objects.create(statusName=status) cls.gr_users = Group.objects.create(name="clients") user = User.objects.create_user(username='******', password="******") profile = UserProfileModel.objects.create(user=user, table=5) user.groups.add(cls.gr_users) sound_st = SoundStatus.objects.get(id=3) sound = Sounds.objects.create(user=user, name='asssa', status=sound_st) for item in range(cls.ITER_COUNT): user = User.objects.create_user(username='******' + str(item), password="******") profile = UserProfileModel.objects.create(user=user, table=item) user.groups.add(cls.gr_users) sound_st = SoundStatus.objects.get(id=3) sound = Sounds.objects.create(user=user, name='asssa' + str(item), status=sound_st) gr_cashiers = Group.objects.create(name="cachers") user_cashier = User.objects.create_user(username='******', password='******') user_cashier.groups.add(gr_cashiers)
def setUpTestData(cls): cls.test_shift = ShiftUser() cls.test_shift.state = True cls.test_shift.save() STATUS = ['pay', 'wait_moder', 'wait_pay', 'post', 'no_moder'] for status in STATUS: cls.status = SoundStatus.objects.create(statusName=status)
def setUpTestData(cls): cls.test_shift = ShiftUser() cls.test_shift.state = True cls.test_shift.save()