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
e8a758e9
Kaydet (Commit)
e8a758e9
authored
Mar 09, 2015
tarafından
Andrei Kulakov
Kaydeden (comit)
Tim Graham
Mar 13, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #24253 -- Documented staff_member_required decorator.
üst
b089759d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
index.txt
docs/ref/contrib/admin/index.txt
+26
-0
default.txt
docs/topics/auth/default.txt
+9
-1
No files found.
docs/ref/contrib/admin/index.txt
Dosyayı görüntüle @
e8a758e9
...
...
@@ -2717,3 +2717,29 @@ The action in the examples above match the last part of the URL names for
:class:`ModelAdmin` instances described above. The ``opts`` variable can be any
object which has an ``app_label`` and ``model_name`` attributes and is usually
supplied by the admin views for the current model.
.. currentmodule:: django.contrib.admin.views.decorators
The ``staff_member_required`` decorator
=======================================
.. function:: staff_member_required([redirect_field_name=REDIRECT_FIELD_NAME, login_url='admin:login'])
This decorator is used on the admin views that require authorization. A
view decorated with this function will having the following behavior:
* If the user is logged in, is a staff member (``User.is_staff=True``), and
is active (``User.is_active=True``), execute the view normally.
* Otherwise, the request will be redirected to the URL specified by the
``login_url`` parameter, with the originally requested path in a query
string variable specified by ``redirect_field_name``. For example:
``/admin/login/?next=/admin/polls/question/3/``.
Example usage::
from django.contrib.admin.views.decorators import staff_member_required
@staff_member_required
def my_view(request):
...
docs/topics/auth/default.txt
Dosyayı görüntüle @
e8a758e9
...
...
@@ -485,7 +485,15 @@ The login_required decorator
.. note::
The login_required decorator does NOT check the is_active flag on a user.
The ``login_required`` decorator does NOT check the ``is_active`` flag on a
user.
.. seealso::
If you are writing custom views for Django's admin (or need the same
authorization check that the built-in views use), you may find the
:func:`django.contrib.admin.views.decorators.staff_member_required`
decorator a useful alternative to ``login_required()``.
Limiting access to logged-in users that pass a test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
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