#36941: Enhancement Proposal for querystring template tag: Support for dynamic
context-based keys
-------------------------------------+-------------------------------------
Reporter: Hristo Trendafilov | Owner: Vishy
Type: | Algo
Cleanup/optimization | Status: closed
Component: Template system | Version: 5.2
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Clifford Gama):
* easy: 1 => 0
* has_patch: 1 => 0
* resolution: => invalid
* status: assigned => closed
Comment:
Thanks for the ticket. Both `querystring` and the `{% with %}` tag are
working as expected, but they don’t support dynamic parameter names, so
they won’t produce the exact output you’re looking for.
You should be able to achieve what you want by writing a custom template
tag that takes a parameter name and value, builds the query string in
Python, and returns the correct URL. You'd then replace `querystring` in
your include template with that tag (which potentially might be a simple
wrapper around `querystring`.
Closing this ticket per
https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels.
If you want to propose a change to the template language syntax itself,
you’d have to open a new feature proposal/suggestion
[https://docs.djangoproject.com/en/dev/internals/contributing/bugs-and-
features/#requesting-features per this documentation].
--
Ticket URL: <https://code.djangoproject.com/ticket/36941#comment:8>
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 visit
https://groups.google.com/d/msgid/django-updates/0107019c94a2cb24-dbf927a4-6f24-42af-abcc-170a3f0020b4-000000%40eu-central-1.amazonses.com.