﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35523	query_string cannot use variables as keys	Sarah Boyce	nobody	"Raised by Florian here: https://forum.djangoproject.com/t/adding-a-template-tag-to-generate-query-strings/24521/15

If we are to add a test:
{{{#!diff
--- a/tests/template_tests/syntax_tests/test_query_string.py
+++ b/tests/template_tests/syntax_tests/test_query_string.py
@@ -98,3 +98,16 @@ class QueryStringTagTests(SimpleTestCase):
         msg = ""'Context' object has no attribute 'request'""
         with self.assertRaisesMessage(AttributeError, msg):
             self.engine.render_to_string(""query_string_no_request_no_query_dict"")
+
+    @setup(
+        {
+            ""query_string_var_key"": '{% with key=""var_key"" %}{% query_string key=2 %}'
+            ""{% endwith %}""
+        }
+    )
+    def test_query_string_with_variable_key(self):
+        request = self.request_factory.get(""/"")
+        template = self.engine.get_template(""query_string_var_key"")
+        context = RequestContext(request)
+        output = template.render(context)
+        self.assertEqual(output, ""?var_key=2"")
}}}

This fails with `AssertionError: '?key=2' != '?var_key=2'`.

One suggestion is to quote literal keys eg. `{% query_string var_key=1 'other_key'=2 %}`

Refs #10941, design decision required, potential release blocker"	Bug	closed	Template system	5.1	Release blocker	wontfix		Tom Carrick Florian Apolloner	Unreviewed	0	0	0	0	0	0
