[Django] #36182: querystring templatetag should render empty querystring as "?" not ""

4 views
Skip to first unread message

Django

unread,
Feb 10, 2025, 2:00:04 PM2/10/25
to django-...@googlegroups.com
#36182: querystring templatetag should render empty querystring as "?" not ""
-------------------------------------+-------------------------------------
Reporter: David Feeley | Type: Bug
Status: new | Component: Template
| system
Version: 5.1 | Severity: Normal
Keywords: querystring | Triage Stage:
templatetag | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Hello,
Consider 2 anchors that link to a filtered and unfiltered version of the
current page via a GET param foo.

{{{
<a href="{% querystring foo=None %}">All Records</a>
<a href="{% querystring foo=bar %}">Bar Records Only</a>
}}}

If the user is currently on the filtered page https://example.com/?foo=bar
and clicks the first link, the querystring template tag, being empty, will
render as "", which means href="" which the browser will interpret as
reload the current (filtered) page. I believe instead the templatetag
should render this case as "?"

[https://github.com/dfeeley/django/compare/main..empty-querystring]

thanks
Dave
--
Ticket URL: <https://code.djangoproject.com/ticket/36182>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Reply all
Reply to author
Forward
0 new messages