Is it possible to pass query parameters via Django's {% url %} template tag?

I'd like to add request parameters to a {% url %} tag, like ?office=foobar.

Is this possible? I can't find anything on it.


No, because the GET parameters are not part of the URL.

Simply add them to the end:

<a href="{% url myview %}?office=foobar">

For Django 1.5+

<a href="{% url 'myview' %}?office=foobar">

A way to mix-up current parameters with new one:

{% url 'order_list' %}?office=foobar&{{ request.GET.urlencode }}

Modify your settings to have request variable:

from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP

TEMPLATE_CONTEXT_PROCESSORS = TCP + (
    'django.core.context_processors.request',
)