[Answered ]-What is the meaning of 'q' in request.GET var?

2πŸ‘

βœ…

It is the param given in url:

...com/?q=variable

So in view you have a dict request.GET and q is the key and variable is the value:

{'q': 'variable'}

If you want to change it in url, like this:

...com/?b=...

You will need to change in your view:

def search(request):
    error = False
    if 'b' in request.GET:
        b = request.GET['b']
        if not b:
            error = True
        else:
          .....

As you can see, just replace q by b or whatever you want to be the name of your param.

Leave a comment