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
eb9b7abb
Kaydet (Commit)
eb9b7abb
authored
Mar 08, 2015
tarafından
Rik
Kaydeden (comit)
Erik Romijn
Mar 08, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #21661 -- Expanded authentication views documentation
üst
e272904f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
9 deletions
+69
-9
default.txt
docs/topics/auth/default.txt
+69
-9
No files found.
docs/topics/auth/default.txt
Dosyayı görüntüle @
eb9b7abb
...
@@ -673,18 +673,78 @@ Django provides several views that you can use for handling login, logout, and
...
@@ -673,18 +673,78 @@ Django provides several views that you can use for handling login, logout, and
password management. These make use of the :ref:`stock auth forms
password management. These make use of the :ref:`stock auth forms
<built-in-auth-forms>` but you can pass in your own forms as well.
<built-in-auth-forms>` but you can pass in your own forms as well.
Django provides no default template for the authentication views - however the
Django provides no default template for the authentication views. You should
template context is documented for each view below.
create your own templates for the views you want to use. The template context
is documented in each view, see :ref:`all-authentication-views`.
The built-in views all return
.. _using-the-views:
a :class:`~django.template.response.TemplateResponse` instance, which allows
you to easily customize the response data before rendering. For more details,
see the :doc:`TemplateResponse documentation </ref/template-response>`.
Most built-in authentication views provide a URL name for easier reference. See
Using the views
:doc:`the URL documentation </topics/http/urls>` for details on using named URL
~~~~~~~~~~~~~~~
patterns.
There are different methods to implement these views in your project. The
easiest way is to include the provided URLconf in ``django.contrib.auth.urls``
in your own URLconf, for example::
urlpatterns = [
url('^', include('django.contrib.auth.urls'))
]
This will include the following URL patterns::
^login/$ [name='login']
^logout/$ [name='logout']
^password_change/$ [name='password_change']
^password_change/done/$ [name='password_change_done']
^password_reset/$ [name='password_reset']
^password_reset/done/$ [name='password_reset_done']
^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$ [name='password_reset_confirm']
^reset/done/$ [name='password_reset_complete']
The views provide a URL name for easier reference. See :doc:`the URL
documentation </topics/http/urls>` for details on using named URL patterns.
If you want more control over your URLs, you can reference a specific view in
your URLconf::
urlpatterns = [
url('^change-password/', 'django.contrib.auth.views.password_change')
]
The views have optional arguments you can use to alter the behavior of the
view. For example, if you want to change the template name a view uses, you can
provide the ``template_name`` argument. A way to do this is to provide keyword
arguments in the URLconf, these will be passed on to the view. For example::
urlpatterns = [
url(
'^change-password/',
'django.contrib.auth.views.password_change',
{'template_name': 'change-password.html'}
)
]
All views return a :class:`~django.template.response.TemplateResponse`
instance, which allows you to easily customize the response data before
rendering. A way to do this is to wrap a view in your own view::
from django.contrib.auth import views
def change_password(request):
template_response = views.password_change(request)
# Do something with `template_response`
return template_response
For more details, see the :doc:`TemplateResponse documentation
</ref/template-response>`.
.. _all-authentication-views:
All authentication views
~~~~~~~~~~~~~~~~~~~~~~~~
This is a list with all the views ``django.contrib.auth`` provides. For
implementation details see :ref:`using-the-views`.
.. function:: login(request, [template_name, redirect_field_name, authentication_form, current_app, extra_context])
.. function:: login(request, [template_name, redirect_field_name, authentication_form, current_app, extra_context])
...
...
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