From 92d5b2f389314f12ad3f5c192e9c56a3938b2b32 Mon Sep 17 00:00:00 2001 From: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> Date: Wed, 12 Feb 2025 17:08:03 +0100 Subject: [5.2.x] Fixed #36182 -- Returned "?" if all parameters are removed in querystring template tag. Thank you to David Feeley for the report and Natalia Bidart for the review. Backport of 05002c153c5018e4429a326a6699c7c45e5ea957 from main. --- tests/template_tests/syntax_tests/test_querystring.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/template_tests/syntax_tests/test_querystring.py') diff --git a/tests/template_tests/syntax_tests/test_querystring.py b/tests/template_tests/syntax_tests/test_querystring.py index dea8ee0142..9979bcb8e2 100644 --- a/tests/template_tests/syntax_tests/test_querystring.py +++ b/tests/template_tests/syntax_tests/test_querystring.py @@ -20,6 +20,18 @@ class QueryStringTagTests(SimpleTestCase): "test_querystring_empty_get_params", context, expected="" ) + @setup({"test_querystring_remove_all_params": "{% querystring a=None %}"}) + def test_querystring_remove_all_params(self): + non_empty_context = RequestContext(self.request_factory.get("/?a=b")) + empty_context = RequestContext(self.request_factory.get("/")) + for context, expected in [(non_empty_context, "?"), (empty_context, "")]: + with self.subTest(expected=expected): + self.assertRenderEqual( + "test_querystring_remove_all_params", + context, + expected, + ) + @setup({"test_querystring_non_empty_get_params": "{% querystring %}"}) def test_querystring_non_empty_get_params(self): request = self.request_factory.get("/", {"a": "b"}) -- cgit v1.3