From 62f960c08144d69ef0c748e97e47f33b957c550d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Mon, 6 Jul 2020 00:10:38 +0800 Subject: [PATCH] Addded a simple authentication request to the cash report view. --- accounting/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/accounting/views.py b/accounting/views.py index 486eacd..d11654c 100644 --- a/accounting/views.py +++ b/accounting/views.py @@ -19,7 +19,7 @@ """ -from django.http import HttpResponseRedirect +from django.http import HttpResponseRedirect, HttpResponse from django.urls import reverse from django.utils import dateformat, timezone @@ -79,6 +79,8 @@ class BaseReportView(generic.ListView): Returns: The response """ + if request.user.is_anonymous: + return HttpResponse(status=401) try: self.page_size = int(request.GET["page-size"]) if self.page_size < 1: @@ -113,6 +115,7 @@ class BaseReportView(generic.ListView): return r + class CashReportView(BaseReportView): """The accounting cash report.""" http_method_names = ["get"]