From 232b976f2d6c3303d9624a8263aa72a8b56369ca Mon Sep 17 00:00:00 2001 From: flifloo Date: Fri, 3 Dec 2021 01:11:23 +0100 Subject: [PATCH] Protect pages with login --- people/views.py | 3 +++ requirements.txt | 3 +++ rescue/views.py | 3 +++ 3 files changed, 9 insertions(+) diff --git a/people/views.py b/people/views.py index b29af5f..3f4dd5d 100644 --- a/people/views.py +++ b/people/views.py @@ -1,3 +1,4 @@ +from django.contrib.auth.decorators import login_required from django.http import Http404, HttpResponseRedirect, HttpResponseBadRequest from django.shortcuts import render from django.urls import reverse @@ -19,6 +20,7 @@ def index(request, people_id: int): }) +@login_required def submit(request): if request.method == "POST": form = SubmitPeople(request.POST) @@ -31,6 +33,7 @@ def submit(request): return render(request, "people/submit.html", {"form": form}) +@login_required def edit(request, people_id: int): edited_people = get_people(people_id) if not edited_people.validated: diff --git a/requirements.txt b/requirements.txt index 32348c3..33d2674 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,8 @@ asgiref==3.4.1 +confusable-homoglyphs==3.2.0 Django==3.2.9 django-quill-editor==0.1.22 +django-registration==3.2 +psycopg2==2.9.2 pytz==2021.3 sqlparse==0.4.2 diff --git a/rescue/views.py b/rescue/views.py index da8792c..de31110 100644 --- a/rescue/views.py +++ b/rescue/views.py @@ -1,3 +1,4 @@ +from django.contrib.auth.decorators import login_required from django.http import Http404, HttpResponseRedirect, HttpResponseBadRequest from django.shortcuts import render from django.urls import reverse @@ -17,6 +18,7 @@ def index(request, rescue_id: int): return render(request, "article/article.html", {"rescue": get_rescue(rescue_id)}) +@login_required def submit(request): if request.method == "POST": form = SubmitRescue(request.POST) @@ -29,6 +31,7 @@ def submit(request): return render(request, "article/submit.html", {"form": form}) +@login_required def edit(request, rescue_id: int): edited_rescue = get_rescue(rescue_id) if not edited_rescue.validated: