mirror of
https://github.com/django/django.git
synced 2025-10-28 16:16:12 +00:00
[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 05002c153c from main.
This commit is contained in:
@@ -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"})
|
||||
|
||||
Reference in New Issue
Block a user