diff --git a/.gitignore b/.gitignore index d58e0b8..e0e05b5 100644 --- a/.gitignore +++ b/.gitignore @@ -159,3 +159,5 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. .idea/ *.iml + +/media diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..3748cdc --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "[python]": { + "editor.defaultFormatter": "ms-python.autopep8", + "editor.formatOnSave": true + } +} diff --git a/dashboard/views.py b/dashboard/views.py index a394363..5368ae7 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -1,55 +1,64 @@ -from django.shortcuts import render +from django.shortcuts import render, redirect from django.views import View - class ViewDashboardView(View): - - def get(self,request): - return render(request,"dashboard.html") - + + def get(self, request): + if request.user.is_authenticated and self.request.user.is_superuser: + return render(request, "dashboard.html") + return redirect('users:login') + + class ViewAdminMenu(View): - - def get(self,request): - return render(request,"menu/admin-menu.html") - + + def get(self, request): + return render(request, "menu/admin-menu.html") + + class ViewAddMenuView(View): - - def get(self,request): - return render(request,"menu/add-menu.html") + + def get(self, request): + return render(request, "menu/add-menu.html") + class ViewUpdateMenuView(View): - - def get(self,request,pk): - return render(request,"menu/update-menu.html") - + + def get(self, request, pk): + return render(request, "menu/update-menu.html") + + class ViewAdminBranchs(View): - - def get(self,request): - return render(request,"branch/admin-branch.html") - + + def get(self, request): + return render(request, "branch/admin-branch.html") + + class ViewAddBranchView(View): - - def get(self,request): - return render(request,"branch/add-branch.html") + + def get(self, request): + return render(request, "branch/add-branch.html") + class ViewUpdateBranchView(View): - - def get(self,request,pk): - return render(request,"branch/update-branch.html") - + + def get(self, request, pk): + return render(request, "branch/update-branch.html") + + class ViewOrder(View): - - def get(self,request): - return render(request,"order/order-management.html") - + + def get(self, request): + return render(request, "order/order-management.html") + + class ViewOrderDetails(View): - - def get(self,request): - return render(request,"order/order-details.html") - + + def get(self, request): + return render(request, "order/order-details.html") + + class ViewOrderAfterStatus(View): - - def get(self,request,pk): - return render(request,"order/order-after-status.html") - \ No newline at end of file + + def get(self, request, pk): + return render(request, "order/order-after-status.html") diff --git a/media/users/default.jpg b/media/users/default.jpg new file mode 100644 index 0000000..b9a3a8b Binary files /dev/null and b/media/users/default.jpg differ diff --git a/requirements.txt b/requirements.txt index 825e832..c55c304 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,5 @@ psycopg==3.1.18 psycopg-binary==3.1.18 sqlparse==0.4.4 typing_extensions==4.11.0 +tzdata==2024.1 whitenoise==6.6.0 diff --git a/templates/base-dashboard.html b/templates/base-dashboard.html index b8e1148..adbaa53 100644 --- a/templates/base-dashboard.html +++ b/templates/base-dashboard.html @@ -53,7 +53,10 @@