multi-checkout stub

This commit is contained in:
Konstantin Martini 2015-01-03 03:09:33 +01:00
parent 756246ba46
commit c3d3b208af
3 changed files with 6 additions and 4 deletions

View File

@ -99,12 +99,14 @@ def checkout(request):
except KeyError as ex:
return HttpResponse(status=400)
count = request.REQUEST.get('count', 1)
count = int(request.REQUEST.get('count', 1))
drink_data = get_drink(drink)
ctx = {
'heading': 'Codes scanned: user=%r drink=%r amount=%s' % (user, drink, count),
'drinker': get_user(user),
'drink': get_drink(drink),
'drink': drink_data,
'total': drink_data.prize * count,
}
return render(request, 'checkout.html', ctx)

View File

@ -4,6 +4,6 @@
<h1>{{ heading }}</h1>
<h2>
{{drinker.name}} spends {{drink.prize}} units on {{drink.name}}.
{{drinker.name}} spends {{total}} units on {{drink.name}}.
</h2>
{% endblock %}

View File

@ -10,7 +10,7 @@
</h2>
<h2>
Have one of these for {{drink.prize}} credits:
Have some of these for {{drink.prize}} credits each:
</h2>
{% for drinker in drinkers %}