title: Removing query string from a view in Django
body: <p>I have a page called controlpanel, where I can start/stop scripts. When the button for start and stop scripts is pressed, it return the same page with button color changed and I want to delete query string.</p>
  
  <p><strong>view.py</strong></p>
  
  <pre class="lang-py prettyprint-override"><code>def controlpanel(request):
     data = {'paypal': paypal_, 'cpu': cpu_usage, 'active': active_task ...}
     return render(request, 'admin/controlpanel.html', context=data) 
  
  def startapp(request):
      if request.META['QUERY_STRING']:
          #... start scripts etc..
          request.META['QUERY_STRING'] = False
  
          return controlpanel(request)  
  
  </code></pre>
  
  <p>the function return controlpanel with query string... (127.0.0.1:8000/startapp?run=True but I only want 127.0.0.1:8000/controlpanel)</p>
  
  <p><strong>controlpanel.html</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div&gt;
  {% if active %}
   &lt;button onclick="f()" class="btn btn-md btn-success"&gt;Start&lt;/button&gt;
  {% else %}
   &lt;button onclick="f()" class="btn btn-md btn-warning"&gt;Start&lt;/button&gt;
  {% endif %}
  &lt;/div&gt;
  
  
  &lt;script&gt;
  function f() {
  let a = null;
  if ('{{active}}' === 'True') {
    a = 'stop'
  } else {
    a = 'start'
  }
  window.location.href = "/startapp?run=" + a;            
  }
  &lt;/script&gt;
  </code></pre>