Protect pages with login
This commit is contained in:
parent
3cd8535ab9
commit
232b976f2d
3 changed files with 9 additions and 0 deletions
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue