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
9c53facc
Kaydet (Commit)
9c53facc
authored
Haz 02, 2016
tarafından
B. J. Potter
Kaydeden (comit)
Tim Graham
Haz 03, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #26596 -- Added Jinja2 {{ csrf_input }} documentation.
üst
26173899
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
15 deletions
+7
-15
csrf.txt
docs/ref/csrf.txt
+7
-15
No files found.
docs/ref/csrf.txt
Dosyayı görüntüle @
9c53facc
...
...
@@ -148,24 +148,16 @@ If you're using AngularJS 1.1.3 and newer, it's sufficient to configure the
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
Other template engin
es
----------------------
Using CSRF in Jinja2 templat
es
----------------------
--------
When using a different template engine than Django's built-in engine, you can
set the token in your forms manually after making sure it's available in the
t
emplate context.
Django's :class:`~django.template.backends.jinja2.Jinja2` template backend
adds ``{{ csrf_input }}`` to the context of all templates which is equivalent
t
o ``{% csrf_token %}`` in the Django template language. For example:
For example, in the Jinja2 template language, your form could contain the
following:
.. code-block:: html+jinja
.. code-block:: html
<div style="display:none">
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
</div>
You can use JavaScript similar to the :ref:`AJAX code <csrf-ajax>` above to get
the value of the CSRF token.
<form action="" method="post">{{ csrf_input }}
The decorator method
--------------------
...
...
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