#34124: Developer experience on {% with %} template tag can be improved.
-------------------------------------+-------------------------------------
Reporter: Oscar Cortez | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Template system | Version: 4.1
Severity: Normal | Resolution: wontfix
Keywords: template tag | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):
* status: new => closed
* resolution: => wontfix
Comment:
Thanks for the report.
> So I believe that we can improve the DX for this template tag and
enforce the values that we want to cache, this means that we should allow
only valid variable names and enforce value casting.
Unfortunately, we cannot do this without breaking backward compatibility
as not only valid identifiers are not supported, e.g.
{{{
{% with key as 123żółć %}{{ 123żółć }}|{{key}}{% endwith %}
}}}
works fine. Moreover, even dotted names, e.g. `post_images.first.image`,
are added to the `context` (as `context["post_images.first.image"] = "some
value"`) so they can be accessed by custom template tags (seems unlikely
but...). I don't think it's worth additional complexity.
If you don't agree, please first start a discussion on the
DevelopersMailingList, where you'll reach a wider audience and see what
other think, and
[https://docs.djangoproject.com/en/stable/internals/contributing/triaging-
tickets/#closing-tickets follow the triaging guidelines with regards to
wontfix tickets].
--
Ticket URL: <https://code.djangoproject.com/ticket/34124#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701841db8a04d-37c8c71d-19a1-4978-852a-39f5ef000e0f-000000%40eu-central-1.amazonses.com.