Skip to content

Commit 3b884d1

Browse files
26 - Creating a User Required Page
1 parent 2f0ec6c commit 3b884d1

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

articles/views.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from django.contrib.auth.decorators import login_required
12
from django.shortcuts import render
23

34
from .models import Article
@@ -20,6 +21,7 @@ def article_search_view(request):
2021
}
2122
return render(request, "articles/search.html", context=context)
2223

24+
@login_required
2325
def article_create_view(request):
2426
# print(request.POST)
2527
context = {}

trydjango/settings.py

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
]
5454

5555
ROOT_URLCONF = 'trydjango.urls'
56+
LOGIN_URL='/login/'
5657

5758
TEMPLATES = [
5859
{

0 commit comments

Comments
 (0)