Search code examples
pythonhtmldjangoattributes

Removing url prefixes in django


Here is my localhost url localhost: 127.0.0.1:/8000/searches/?q=css I want to get rid of these: '?q='

I tried removing the name attributes from my html.

<input type="text">


Solution

  • Let's assume this is the code:

    <input type="text" name="q" value="">
    

    Now

    Request.POST/GET['q']
    

    takes 'q' as a variable to your value thereby making it needless to remove 'q=' from your url.