Refactored CSS and HTML templates and polished UI (#10), changed JavaScript variable names to camelCase, adjusted filenames and some url parameter names in urlpatterns, and more.

This commit is contained in:
W13R 2022-11-04 20:35:28 +01:00
parent 1e32e2b5dd
commit 8599f49857
30 changed files with 401 additions and 403 deletions

View file

@ -84,9 +84,9 @@ def history(request):
return render(request, "history.html", context)
@login_required
def order(request, drinkID):
def order(request, drinkid):
try:
drink_ = Drink.objects.get(pk=drinkID)
drink_ = Drink.objects.get(pk=drinkid)
context = {
"drink": drink_
}
@ -148,10 +148,10 @@ def api_order_drink(request):
if user.allow_order_with_negative_balance or user.balance > 0:
drinkID = int(request.POST["drinkID"])
amount = int(request.POST["numberOfDrinks"])
drinkid = int(request.POST["drinkid"])
amount = int(request.POST["numberofdrinks"])
drink = Drink.objects.get(pk=drinkID)
drink = Drink.objects.get(pk=drinkid)
if ((drink.do_not_count and drink.available > 0) or (drink.available >= amount)) and not drink.deleted:
Order.objects.create(drink=drink, user=user, amount=amount)
@ -175,7 +175,7 @@ def api_deposit(request):
try:
amount = decimal.Decimal(request.POST["depositAmount"])
amount = decimal.Decimal(request.POST["depositamount"])
if 0.00 < amount < 9999.99:
# create transaction
@ -202,8 +202,8 @@ def api_supply(request):
try:
price = decimal.Decimal(request.POST["supplyPrice"])
description = str(request.POST["supplyDescription"])
price = decimal.Decimal(request.POST["supplyprice"])
description = str(request.POST["supplydescription"])
if 0.00 < price < 9999.99 and (user.allowed_to_supply or user.is_superuser):
# create transaction