summaryrefslogtreecommitdiff
path: root/docs/topics/auth/default.txt
diff options
context:
space:
mode:
Diffstat (limited to 'docs/topics/auth/default.txt')
-rw-r--r--docs/topics/auth/default.txt12
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt
index 72205740d5..4c8d44a0cd 100644
--- a/docs/topics/auth/default.txt
+++ b/docs/topics/auth/default.txt
@@ -306,9 +306,9 @@ of :class:`~django.contrib.auth.models.AnonymousUser`, otherwise it will be an
instance of :class:`~django.contrib.auth.models.User`.
You can tell them apart with
-:meth:`~django.contrib.auth.models.User.is_authenticated()`, like so::
+:attr:`~django.contrib.auth.models.User.is_authenticated`, like so::
- if request.user.is_authenticated():
+ if request.user.is_authenticated:
# Do something for authenticated users.
...
else:
@@ -421,15 +421,15 @@ The raw way
~~~~~~~~~~~
The simple, raw way to limit access to pages is to check
-:meth:`request.user.is_authenticated()
-<django.contrib.auth.models.User.is_authenticated()>` and either redirect to a
+:attr:`request.user.is_authenticated
+<django.contrib.auth.models.User.is_authenticated>` and either redirect to a
login page::
from django.conf import settings
from django.shortcuts import redirect
def my_view(request):
- if not request.user.is_authenticated():
+ if not request.user.is_authenticated:
return redirect('%s?next=%s' % (settings.LOGIN_URL, request.path))
# ...
@@ -438,7 +438,7 @@ login page::
from django.shortcuts import render
def my_view(request):
- if not request.user.is_authenticated():
+ if not request.user.is_authenticated:
return render(request, 'myapp/login_error.html')
# ...