Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
268670a3
Kaydet (Commit)
268670a3
authored
May 17, 2014
tarafından
Víðir Valberg Guðmundsson
Kaydeden (comit)
Tim Graham
May 17, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #22647 -- Documented redirect_field_name keyword argument for user_passes_test.
üst
727d048f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
4 deletions
+14
-4
default.txt
docs/topics/auth/default.txt
+14
-4
No files found.
docs/topics/auth/default.txt
Dosyayı görüntüle @
268670a3
...
@@ -507,7 +507,7 @@ checks to make sure the user has an email in the desired domain::
...
@@ -507,7 +507,7 @@ checks to make sure the user has an email in the desired domain::
return HttpResponse("You can't vote in this poll.")
return HttpResponse("You can't vote in this poll.")
# ...
# ...
.. function:: user_passes_test(func, [login_url=None])
.. function:: user_passes_test(func, [login_url=None
, redirect_field_name=REDIRECT_FIELD_NAME
])
As a shortcut, you can use the convenient ``user_passes_test`` decorator::
As a shortcut, you can use the convenient ``user_passes_test`` decorator::
...
@@ -528,9 +528,19 @@ checks to make sure the user has an email in the desired domain::
...
@@ -528,9 +528,19 @@ checks to make sure the user has an email in the desired domain::
automatically check that the :class:`~django.contrib.auth.models.User` is
automatically check that the :class:`~django.contrib.auth.models.User` is
not anonymous.
not anonymous.
:func:`~django.contrib.auth.decorators.user_passes_test()` takes an
:func:`~django.contrib.auth.decorators.user_passes_test` takes two
optional ``login_url`` argument, which lets you specify the URL for your
optional arguments:
login page (:setting:`settings.LOGIN_URL <LOGIN_URL>` by default).
``login_url``
Lets you specify the URL that users who don't pass the test will be
redirected to. It may be a login page and defaults to
:setting:`settings.LOGIN_URL <LOGIN_URL>` if you don't specify one.
``redirect_field_name``
Same as for :func:`~django.contrib.auth.decorators.login_required`.
Setting it to ``None`` removes it from the URL, which you may want to do
if you are redirecting users that don't pass the test to a non-login
page where there's no "next page".
For example::
For example::
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment