code: def query_string(context, key, value):
      
      try:
          request = context['request']
          args = request.GET.copy()
      except KeyError:
          args = QueryDict('').copy()
      args[key] = value
      return args.urlencode()
docs: For adding/replacing a key=value pair to the GET string for a URL.
  
      eg, if we're viewing ?p=3 and we do {% query_string order 'taken' %}
      then this returns "p=3&order=taken"
  
      And, if we're viewing ?p=3&order=uploaded and we do the same thing, we get
      the same result (ie, the existing "order=uploaded" is replaced).
  
      Expects the request object in context to do the above; otherwise it will
      just return a query string with the supplied key=value pair.