'querystring' received too many positional arguments when passed a QueryDict

I'm using Django 5.2 and I can't get my head around the following issue:

In my view, I have something like this:

removal_qs = request.GET.copy() # contains teams=1&teams=2
removal_qs.setlist('teams', [1])

Debugging shows:

In [3]: type(removal_qs)
Out[3]: django.http.request.QueryDict

But when I try to use this with the {% querystring %} tag in a template, like so

<a href="{{ request.path }}{% querystring qs %}">x</a>

I get the error 'querystring' received too many positional arguments.

The documentation for the querystring template tag specifically says that

This tag requires a QueryDict instance, which defaults to request.GET if none is provided.

So where am I doing this wrong?

Вернуться на верх