It appears that I forgot to document it.
--
Ticket URL: <https://code.djangoproject.com/ticket/26596>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by timgraham):
There's a mention in the
[https://docs.djangoproject.com/en/dev/topics/templates/#django.template.backends.jinja2.Jinja2
Jinja2 backend] docs. Did you miss it or have another place in mind?
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:1>
Comment (by aaugustin):
I saw that mention but I don't think it's sufficiently explicit about how
to use that variable.
We should say that:
- {% csrf_token %} in Django templates translates to {{ csrf_input }} in
Jinja2 templates
- {{ csrf_token }} works identically in Django templates and in Jinja2
templates
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:2>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:3>
* cc: betojulio@… (added)
* owner: nobody => betojulio
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:4>
* Attachment "26596.diff" added.
diff file
Comment (by betojulio):
Hi I just uploaded a diff file. Are this the changes needed?
Thanks
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:5>
Comment (by aaugustin):
I believe this information would be more discoverable in the CSRF
reference documentation, either in the "How to use it" section or in a new
section.
We should talk about:
- the API offered by built-in template backends
- requirements for third-party backends, as described in PEP 182
(basically they have to provide a solution, but that solution isn't
specified)
This will likely require tweaking the content a bit to clarify that the
main examples are specific to Django templates.
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:6>
Comment (by betojulio):
ok, I am working on it!
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:7>
Comment (by betojulio):
>{% csrf_token %} in Django templates translates to {{ csrf_input }} in
Jinja2 templates
This is already specified in
https://docs.djangoproject.com/en/dev/ref/csrf/#other-template-engines
>{{ csrf_token }} works identically in Django templates and in Jinja2
templates
Should I put another example in step # 2 in
https://docs.djangoproject.com/en/dev/ref/csrf/#how-to-use-it ?, something
like
{{{
<div style="display:none">
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token
}}">
</div>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:8>
Comment (by aaugustin):
The paragraph you just linked to only mentions `{{ csrf_token }}`, not `{{
csrf_input }}`.
It's precisely because it's incomplete that I filed this ticket.
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:9>
* status: assigned => new
* owner: betojulio =>
Comment:
Since it's been three weeks without a status update, I'm freeing this
ticket up for claiming by a PyCon sprinter.
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:10>
* owner: => bjcubsfan
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:11>
* owner: bjcubsfan => phildini
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:12>
* owner: phildini =>
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:13>
* status: new => assigned
* owner: => bjcubsfan
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:14>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:15>
Comment (by bjcubsfan):
Replying to [comment:6 aaugustin]:
> I believe this information would be more discoverable in the CSRF
reference documentation, either in the "How to use it" section or in a new
section.
>
> We should talk about:
> - the API offered by built-in template backends
> - requirements for third-party backends, as described in PEP 182
(basically they have to provide a solution, but that solution isn't
specified)
>
> This will likely require tweaking the content a bit to clarify that the
main examples are specific to Django templates.
I think you mean [https://github.com/django/deps/blob/master/final/0182
-multiple-template-engines.rst DEP 182].
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:16>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:16>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:17>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:18>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"9c53facc45908bc0593de194a60bc75e5d34a48e" 9c53facc]:
{{{
#!CommitTicketReference repository=""
revision="9c53facc45908bc0593de194a60bc75e5d34a48e"
Fixed #26596 -- Added Jinja2 {{ csrf_input }} documentation.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:19>
Comment (by Tim Graham <timograham@…>):
In [changeset:"926529d6189bd0749067f8567b4e34bbf8b0e545" 926529d]:
{{{
#!CommitTicketReference repository=""
revision="926529d6189bd0749067f8567b4e34bbf8b0e545"
[1.10.x] Fixed #26596 -- Added Jinja2 {{ csrf_input }} documentation.
Backport of 9c53facc45908bc0593de194a60bc75e5d34a48e from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:20>
Comment (by Tim Graham <timograham@…>):
In [changeset:"16ce7a51ea5147949d652f8bf60b6e215ec16d8d" 16ce7a51]:
{{{
#!CommitTicketReference repository=""
revision="16ce7a51ea5147949d652f8bf60b6e215ec16d8d"
[1.9.x] Fixed #26596 -- Added Jinja2 {{ csrf_input }} documentation.
Backport of 9c53facc45908bc0593de194a60bc75e5d34a48e from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26596#comment:21>