From fe1a52ceb91dcf7c43965d19542be26cc6829081 Mon Sep 17 00:00:00 2001 From: fathonidf Date: Wed, 4 Oct 2023 16:09:32 +0700 Subject: [PATCH] selesai tutorial 5 dan bonus --- main/templates/main.html | 4 ++++ main/views.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/main/templates/main.html b/main/templates/main.html index 34107f7..0cdf496 100644 --- a/main/templates/main.html +++ b/main/templates/main.html @@ -126,6 +126,8 @@
Sesi terakhir login: {{ last_login }}
Price Description Date Added + Edit Product + Delete ` products.forEach((item) => { htmlString += `\n @@ -133,6 +135,8 @@
Sesi terakhir login: {{ last_login }}
${item.fields.price} ${item.fields.description} ${item.fields.date_added} + + ` }) diff --git a/main/views.py b/main/views.py index 394fd5d..e844f31 100644 --- a/main/views.py +++ b/main/views.py @@ -22,7 +22,7 @@ def show_main(request): 'name': request.user.username, 'class': 'PBP E', 'products': products, - 'last_login': request.COOKIES['last_login'] + 'last_login': request.COOKIES.get('last_login') } return render(request, "main.html", context)