|
|
|
|
@ -22,6 +22,7 @@ def login_requiered(func): |
|
|
|
|
return func(*args, **kwargs) |
|
|
|
|
else: |
|
|
|
|
return redirect('login_view') |
|
|
|
|
|
|
|
|
|
return wrapper |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -40,6 +41,7 @@ def list_of_teas(): |
|
|
|
|
|
|
|
|
|
return {'categories': dic, 'ms': [0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500]} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def list_of_choices(): |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
@ -54,10 +56,11 @@ def home(request): |
|
|
|
|
def confirm_choose(request): |
|
|
|
|
if request.user.is_authenticated: |
|
|
|
|
choice = json.loads(request.body.decode(encoding='UTF-8')) |
|
|
|
|
d ={} |
|
|
|
|
d = {} |
|
|
|
|
for key in choice: |
|
|
|
|
tea = Tea.objects.get(name=key) |
|
|
|
|
d[tea.id] = choice[key] |
|
|
|
|
if choice[key] != 0: |
|
|
|
|
tea = Tea.objects.get(name=key) |
|
|
|
|
d[tea.id] = choice[key] |
|
|
|
|
choice_string = json.dumps(d, sort_keys=True) |
|
|
|
|
previous = Choice.objects.filter(users__in=[request.user]).first() |
|
|
|
|
if previous is not None: |
|
|
|
|
|