diff --git a/reValuate/db.sqlite3 b/reValuate/db.sqlite3 index 1f439944..1ac9371d 100644 Binary files a/reValuate/db.sqlite3 and b/reValuate/db.sqlite3 differ diff --git a/reValuate/home/__pycache__/views.cpython-38.pyc b/reValuate/home/__pycache__/views.cpython-38.pyc index 6efcb682..850f8438 100644 Binary files a/reValuate/home/__pycache__/views.cpython-38.pyc and b/reValuate/home/__pycache__/views.cpython-38.pyc differ diff --git a/reValuate/home/views.py b/reValuate/home/views.py index 18728401..30a96304 100644 --- a/reValuate/home/views.py +++ b/reValuate/home/views.py @@ -10,38 +10,39 @@ def homePage(request): Cashier = False Processor = False + + balObject = Balance.objects.filter(user=request.user.id) + userBalance = balObject.values("balanceValue") try: - balObject = Balance.objects.filter(user=request.user.id) - userBalance = balObject.values("balanceValue") - userQR = f"Name = {request.user.username}, Date Joined = {request.user.date_joined.date()}, ID = {request.user.id}, Balance = {userBalance[0]['balanceValue']}" - if request.user.groups.filter(name='Cashier').exists(): - Cashier = True - elif request.user.groups.filter(name='Processor').exists(): - Processor = True - else: - pass - a = Balance.objects.all() + userBalance = userBalance[0]['balanceValue'] + except IndexError: + userBalance = None + if request.user.groups.filter(name='Cashier').exists(): + Cashier = True + elif request.user.groups.filter(name='Processor').exists(): + Processor = True + else: + pass + if request.user.is_authenticated: + userQR = f"Name = {request.user.username}, Date Joined = {request.user.date_joined.date()}, ID = {request.user.id}, isCashier={Cashier}, isProcessor={Processor}, Balance = {userBalance}" + else: + userQR=None + a = Balance.objects.all() - for user in a: - all_balance.append(user.balanceValue) - print(f"{all_balance}") - limited_coins = settings.ALL_COINS - sum(all_balance) - context = { - "isCashier": Cashier, - "isProcessor": Processor, - "userQR":userQR, - "fullbalance": limited_coins, - "currencyTotal": sum(all_balance), - "userBalance": userBalance[0]["balanceValue"] - } + for user in a: + all_balance.append(user.balanceValue) + print(f"{all_balance}") + limited_coins = settings.ALL_COINS - sum(all_balance) + context = { + "isCashier": Cashier, + "isProcessor": Processor, + "userQR":userQR, + "fullbalance": limited_coins, + "currencyTotal": sum(all_balance), + "userBalance": userBalance + } - - return render(request, "home.html", context) - + + return render(request, "home.html", context) + - except Exception as e: - - context = { - "currencyTotal":e - } - return render(request, "home.html", context) \ No newline at end of file diff --git a/reValuate/media/1/PngItem_1280311_6mFEE04.png b/reValuate/media/1/PngItem_1280311_6mFEE04.png new file mode 100644 index 00000000..c6f113a5 Binary files /dev/null and b/reValuate/media/1/PngItem_1280311_6mFEE04.png differ diff --git a/reValuate/media/5/pexels-mali-maeder-802221.jpg b/reValuate/media/5/pexels-mali-maeder-802221.jpg new file mode 100644 index 00000000..473acc3f Binary files /dev/null and b/reValuate/media/5/pexels-mali-maeder-802221.jpg differ diff --git a/reValuate/templates/adminView.html b/reValuate/templates/adminView.html index f146ae04..2f2efc4b 100644 --- a/reValuate/templates/adminView.html +++ b/reValuate/templates/adminView.html @@ -69,7 +69,7 @@ {% else %} -

Congratulations, there is no work left

+

Няма повече работа!

🎉

🥳

diff --git a/reValuate/templates/base.html b/reValuate/templates/base.html index f2a39a64..9c564c3f 100644 --- a/reValuate/templates/base.html +++ b/reValuate/templates/base.html @@ -29,16 +29,11 @@