title: Django redirect using reverse() to a URL that relies on query strings
body: <p>I'm writing a django application with a URL like 'http://localhost/entity/id/?overlay=other_id'.  Where id is the primary key of the particular entity and overlay is an optional query parameter for a second entity to be overlaid in the display.  The user can only ever update an entity when viewing objects through an overlay.  When POSTing to /update/id, I want to redirect back to /entity/id, but I don't want to lose my query parameter during the redirect, as the change in view would be jarring.</p>
  
  <p>For example, I've got the following in my url.py:</p>
  
  <pre><code>...
  (r'^update/(?P&lt;id&gt;.+)/(?P&lt;overlay_id&gt;.+)/$', 'update'),
  (r'^entity/(?P&lt;id&gt;.+)/$', 'view'),
  ...
  </code></pre>
  
  <p>Because overlay_id is required when updating, it's part of the URL, not a query parameter.  In the django view I want to redirect after a successful POST and use reverse() to avoid referencing URLs in my python code.  The general idea is:</p>
  
  <pre><code>return HttpResponseRedirect(
    reverse('views.view',
      kwargs={
        'id': id,
      },
    )
  )
  </code></pre>
  
  <p>But how do I pass my query parameter though reverse?</p>
  
  <p>Thanks,
  Craig</p>